Date: Mon, 24 Dec 2001 15:49:10 +0100 (CET) From: Thomas Quinot <thomas@cuivre.fr.eu.org> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/33151: sbin/sysctl: unreachable and duplicated code [patch included] Message-ID: <20011224144910.8609460@melusine.cuivre.fr.eu.org>
next in thread | raw e-mail | index | archive | help
>Number: 33151
>Category: bin
>Synopsis: sbin/sysctl: unreachable and duplicated code [patch included]
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Dec 24 06:50:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Thomas Quinot
>Release: FreeBSD 4.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD melusine.cuivre.fr.eu.org 4.4-STABLE FreeBSD 4.4-STABLE #3: Mon Dec 17 01:07:53 CET 2001 root@melusine.cuivre.fr.eu.org:/usr/obj/usr/src/sys/MELUSINE i386
>Description:
* In parse(), when a value is given for a CTLTYPE_QUAD variable,
newval and newsize erroneously fail to be set because of an early "break".
* show_var() contains code that duplicates the functionality of the
oidfmt() function.
>How-To-Repeat:
UTSL.
>Fix:
--- sysctl.c.dist Mon Dec 24 14:31:10 2001
+++ sysctl.c Mon Dec 24 15:39:37 2001
@@ -213,7 +213,6 @@
case CTLTYPE_STRING:
break;
case CTLTYPE_QUAD:
- break;
sscanf(newval, "%qd", &quadval);
newval = &quadval;
newsize = sizeof(quadval);
@@ -425,16 +424,8 @@
return (0);
}
- qoid[1] = 4;
- j = sizeof(buf);
- i = sysctl(qoid, nlen + 2, buf, &j, 0, 0);
- if (i || !j)
- err(1, "sysctl fmt %d %d %d", i, j, errno);
-
- kind = *(u_int *)buf;
-
- fmt = (char *)(buf + sizeof(u_int));
-
+ fmt = buf;
+ oidfmt(oid, nlen, fmt, &kind);
p = val;
switch (*fmt) {
case 'A':
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011224144910.8609460>
