diff options
author | mtm <mtm@FreeBSD.org> | 2008-06-23 22:06:28 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2008-06-23 22:06:28 +0000 |
commit | 5b37d9eba744dee55431a0426bafd09eef483fea (patch) | |
tree | 143050b4a26dfcca36087688ac911ef3e62dfd91 /sbin | |
parent | 437891381c13fcfea1097ae4d151f60dbcd8f601 (diff) | |
download | FreeBSD-src-5b37d9eba744dee55431a0426bafd09eef483fea.zip FreeBSD-src-5b37d9eba744dee55431a0426bafd09eef483fea.tar.gz |
The sysctl(8) program exits on some errors and only emits warnings on
others. In the case where it displayed warnings it would still return
succesfully. Modify it so that it returns the number of sysctls that
it was not able to set.
Make use of this in rc.d to display only *unsuccessfull* attempts to
set sysctls.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/sysctl/sysctl.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 9dcfcb0..bcb5a11 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -59,7 +59,7 @@ static const char rcsid[] = #include <unistd.h> static int aflag, bflag, dflag, eflag, hflag, Nflag, nflag, oflag; -static int qflag, xflag; +static int qflag, xflag, warncount; static int oidfmt(int *, int, char *, u_int *); static void parse(char *); @@ -146,9 +146,11 @@ main(int argc, char **argv) exit(sysctl_all(0, 0)); if (argc == 0) usage(); + + warncount = 0; while (argc-- > 0) parse(*argv++); - exit(0); + exit(warncount); } /* @@ -304,6 +306,7 @@ parse(char *string) string); default: warn("%s", string); + warncount++; return; } } |