From owner-freebsd-bugs@FreeBSD.ORG Tue Oct 27 15:00:03 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C209106568D for ; Tue, 27 Oct 2009 15:00:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 375078FC1B for ; Tue, 27 Oct 2009 15:00:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n9RF03BF035346 for ; Tue, 27 Oct 2009 15:00:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n9RF03a6035345; Tue, 27 Oct 2009 15:00:03 GMT (envelope-from gnats) Resent-Date: Tue, 27 Oct 2009 15:00:03 GMT Resent-Message-Id: <200910271500.n9RF03a6035345@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ulrich Spörlein Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E12A106568D for ; Tue, 27 Oct 2009 14:57:02 +0000 (UTC) (envelope-from uqs@spoerlein.net) Received: from acme.spoerlein.net (cl-43.dus-01.de.sixxs.net [IPv6:2a01:198:200:2a::2]) by mx1.freebsd.org (Postfix) with ESMTP id E328D8FC1C for ; Tue, 27 Oct 2009 14:57:01 +0000 (UTC) Received: from acme.spoerlein.net (localhost.spoerlein.net [IPv6:::1]) by acme.spoerlein.net (8.14.3/8.14.3) with ESMTP id n9REv03j085668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Oct 2009 15:57:00 +0100 (CET) (envelope-from uqs@acme.spoerlein.net) Received: (from uqs@localhost) by acme.spoerlein.net (8.14.3/8.14.3/Submit) id n9REv0DQ085667; Tue, 27 Oct 2009 15:57:00 +0100 (CET) (envelope-from uqs) Message-Id: <200910271457.n9REv0DQ085667@acme.spoerlein.net> Date: Tue, 27 Oct 2009 15:57:00 +0100 (CET) From: Ulrich Spörlein To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/140016: sysctl(8) raise WARNS to 3 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 15:00:03 -0000 >Number: 140016 >Category: bin >Synopsis: sysctl(8) raise WARNS to 3 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Oct 27 15:00:02 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Ulrich Spörlein >Release: FreeBSD 7.2-STABLE i386 >Organization: >Environment: >Description: Fixes taken from DragonflyBSD >How-To-Repeat: >Fix: --- sysctl.patch begins here --- diff -r 4ac60f34976d -r 860e96dcdced sbin/sysctl/Makefile --- a/sbin/sysctl/Makefile Mon Oct 19 17:02:14 2009 +0200 +++ b/sbin/sysctl/Makefile Mon Oct 19 17:17:13 2009 +0200 @@ -2,7 +2,7 @@ # $FreeBSD$ PROG= sysctl -WARNS?= 0 +WARNS?= 3 MAN= sysctl.8 .include diff -r 4ac60f34976d -r 860e96dcdced sbin/sysctl/sysctl.c --- a/sbin/sysctl/sysctl.c Mon Oct 19 17:02:14 2009 +0200 +++ b/sbin/sysctl/sysctl.c Mon Oct 19 17:17:13 2009 +0200 @@ -274,7 +274,10 @@ case CTLTYPE_STRING: break; case CTLTYPE_QUAD: - sscanf(newval, "%qd", &quadval); + quadval = strtoq(newval, &endptr, 0); + if (endptr == newval || *endptr != '\0') + errx(1, "invalid quad integer" + " '%s'", (char *)newval); newval = &quadval; newsize = sizeof(quadval); break; @@ -329,7 +332,7 @@ struct clockinfo *ci = (struct clockinfo*)p; if (l2 != sizeof(*ci)) { - warnx("S_clockinfo %d != %d", l2, sizeof(*ci)); + warnx("S_clockinfo %d != %zu", l2, sizeof(*ci)); return (1); } printf(hflag ? "{ hz = %'d, tick = %'d, profhz = %'d, stathz = %'d }" : @@ -344,7 +347,7 @@ struct loadavg *tv = (struct loadavg*)p; if (l2 != sizeof(*tv)) { - warnx("S_loadavg %d != %d", l2, sizeof(*tv)); + warnx("S_loadavg %d != %zu", l2, sizeof(*tv)); return (1); } printf(hflag ? "{ %'.2f %'.2f %'.2f }" : "{ %.2f %.2f %.2f }", @@ -362,7 +365,7 @@ char *p1, *p2; if (l2 != sizeof(*tv)) { - warnx("S_timeval %d != %d", l2, sizeof(*tv)); + warnx("S_timeval %d != %zu", l2, sizeof(*tv)); return (1); } printf(hflag ? "{ sec = %'jd, usec = %'ld } " : @@ -384,7 +387,7 @@ int pageKilo = getpagesize() / 1024; if (l2 != sizeof(*v)) { - warnx("S_vmtotal %d != %d", l2, sizeof(*v)); + warnx("S_vmtotal %d != %zu", l2, sizeof(*v)); return (1); } @@ -416,7 +419,7 @@ dev_t *d = (dev_t *)p; if (l2 != sizeof(*d)) { - warnx("T_dev_T %d != %d", l2, sizeof(*d)); + warnx("T_dev_T %d != %zu", l2, sizeof(*d)); return (1); } if ((int)(*d) != -1) { @@ -520,7 +523,7 @@ j = sizeof(buf); i = sysctl(qoid, len + 2, buf, &j, 0, 0); if (i) - err(1, "sysctl fmt %d %d %d", i, j, errno); + err(1, "sysctl fmt %d %zu %d", i, j, errno); if (kind) *kind = *(u_int *)buf; @@ -562,7 +565,7 @@ j = sizeof(name); i = sysctl(qoid, nlen + 2, name, &j, 0, 0); if (i || !j) - err(1, "sysctl name %d %d %d", i, j, errno); + err(1, "sysctl name %d %zu %d", i, j, errno); if (Nflag) { printf("%s", name); @@ -613,7 +616,7 @@ case 'A': if (!nflag) printf("%s%s", name, sep); - printf("%.*s", len, p); + printf("%.*s", (int)len, p); free(oval); return (0); @@ -700,7 +703,7 @@ } if (!nflag) printf("%s%s", name, sep); - printf("Format:%s Length:%d Dump:0x", fmt, len); + printf("Format:%s Length:%zu Dump:0x", fmt, len); while (len-- && (xflag || p < val + 16)) printf("%02x", *p++); if (!xflag && len > 16) @@ -736,7 +739,7 @@ if (errno == ENOENT) return (0); else - err(1, "sysctl(getnext) %d %d", j, l2); + err(1, "sysctl(getnext) %d %zu", j, l2); } l2 /= sizeof(int); --- sysctl.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: