Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

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

one-line change in sysctl



The following one-line change to sysctl allows one to use hexadecimal
constants in setting integer variables. Would someone care to apply it ?
This is for -current as of today (19aug96) but the same applies to 2.1.X
No changes to the manpage are necessary, I think.

	Luigi

# diff -bwu sysctl.c.orig sysctl.c
--- sysctl.c.orig       Mon Aug 19 16:54:49 1996
+++ sysctl.c    Mon Aug 19 16:55:19 1996
@@ -166,7 +166,7 @@
 
                switch (kind & CTLTYPE) {
                        case CTLTYPE_INT:
-                               intval = atoi(newval);
+                               sscanf(newval, "%i", &intval);
                                newval = &intval;
                                newsize = sizeof intval;
                                break;