Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/sysctl fix bug found by clang.



details:   https://anonhg.NetBSD.org/src/rev/cfb79e298058
branches:  trunk
changeset: 783100:cfb79e298058
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 05 13:53:39 2012 +0000

description:
fix bug found by clang.

diffstat:

 sbin/sysctl/sysctl.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r aacf3537d276 -r cfb79e298058 sbin/sysctl/sysctl.c
--- a/sbin/sysctl/sysctl.c      Wed Dec 05 08:57:53 2012 +0000
+++ b/sbin/sysctl/sysctl.c      Wed Dec 05 13:53:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl.c,v 1.146 2012/12/01 15:30:16 christos Exp $ */
+/*     $NetBSD: sysctl.c,v 1.147 2012/12/05 13:53:39 christos Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 #if 0
 static char sccsid[] = "@(#)sysctl.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: sysctl.c,v 1.146 2012/12/01 15:30:16 christos Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.147 2012/12/05 13:53:39 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -2722,7 +2722,7 @@
        char *s = strdup(v);
        if (s == NULL)
                err(1, "");
-       __BITMAP_ZERO(o);
+
        for (s = strtok(s, ","); s; s = strtok(NULL, ",")) {
                char *e;
                errno = 0;
@@ -2749,6 +2749,7 @@
 
        osz = sizeof(o);
        if (value) {
+               __BITMAP_ZERO(n);
                bitmask_scan(value, n);
                value = (char *)n;
                nsz = sizeof(n);



Home | Main Index | Thread Index | Old Index