NetBSD-Bugs archive

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

Re: install/41117: ddb.onpanic=0 in default sysctl.conf(5) could cause error



On Apr 1,  2:40pm, cube%cubidou.net@localhost (Quentin Garnier) wrote:
-- Subject: Re: install/41117: ddb.onpanic=0 in default sysctl.conf(5) could 

|  And it doesn't prevent the message from being printed for a custom,
|  no-DDB kernel.

This is a very stupid patch that implements ?=
It will make things that do foo='???' fail, but I don't think that there
are any ?'s in sysctl name or values.

christos

Index: sysctl.c
===================================================================
RCS file: /cvsroot/src/sbin/sysctl/sysctl.c,v
retrieving revision 1.128
diff -u -u -r1.128 sysctl.c
--- sysctl.c    20 Mar 2009 13:18:50 -0000      1.128
+++ sysctl.c    1 Apr 2009 15:07:01 -0000
@@ -788,9 +788,14 @@
        u_int namelen, type;
        char *key, *value, *dot;
        size_t sz;
+       bool optional = false;
 
        req = 1;
        key = l;
+       if ((value = strchr(l, '?')) != NULL) {
+               *value = '\0';
+               optional = true;
+       }
        value = strchr(l, '=');
        if (value != NULL)
                *value++ = '\0';
@@ -836,6 +841,8 @@
 
        if (sysctlgetmibinfo(key, &name[0], &namelen, gsname, &sz, &node,
                             SYSCTL_VERSION) == -1) {
+               if (optional)
+                       return;
                sysctlparseerror(namelen, l);
                EXIT(1);
        }


Home | Main Index | Thread Index | Old Index