diff options
author | alfred <alfred@FreeBSD.org> | 2002-05-24 08:34:18 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2002-05-24 08:34:18 +0000 |
commit | 67cc400f56ba5291d16f74b024a79c1999ad4112 (patch) | |
tree | 45c6b9930d2052d513aebe18a148c457ef802ee8 /sbin/sysctl/sysctl.c | |
parent | 869c418b2724942b1c2d68dac0be5a51b0a85d8d (diff) | |
download | FreeBSD-src-67cc400f56ba5291d16f74b024a79c1999ad4112.zip FreeBSD-src-67cc400f56ba5291d16f74b024a79c1999ad4112.tar.gz |
Don't err(3) (and exit prematurely) when a sysctl's object size has
changed, instead just warn(3)
Diffstat (limited to 'sbin/sysctl/sysctl.c')
-rw-r--r-- | sbin/sysctl/sysctl.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 1b6495d..f499f63 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -275,8 +275,10 @@ static int S_clockinfo(int l2, void *p) { struct clockinfo *ci = (struct clockinfo*)p; - if (l2 != sizeof(*ci)) - err(1, "S_clockinfo %d != %d", l2, sizeof(*ci)); + if (l2 != sizeof(*ci)) { + warnx("S_clockinfo %d != %d", l2, sizeof(*ci)); + return (0); + } printf("{ hz = %d, tick = %d, profhz = %d, stathz = %d }", ci->hz, ci->tick, ci->profhz, ci->stathz); return (0); @@ -287,9 +289,10 @@ S_loadavg(int l2, void *p) { struct loadavg *tv = (struct loadavg*)p; - if (l2 != sizeof(*tv)) - err(1, "S_loadavg %d != %d", l2, sizeof(*tv)); - + if (l2 != sizeof(*tv)) { + warnx("S_loadavg %d != %d", l2, sizeof(*tv)); + return (0); + } printf("{ %.2f %.2f %.2f }", (double)tv->ldavg[0]/(double)tv->fscale, (double)tv->ldavg[1]/(double)tv->fscale, @@ -304,8 +307,10 @@ S_timeval(int l2, void *p) time_t tv_sec; char *p1, *p2; - if (l2 != sizeof(*tv)) - err(1, "S_timeval %d != %d", l2, sizeof(*tv)); + if (l2 != sizeof(*tv)) { + warnx("S_timeval %d != %d", l2, sizeof(*tv)); + return (0); + } printf("{ sec = %ld, usec = %ld } ", tv->tv_sec, tv->tv_usec); tv_sec = tv->tv_sec; @@ -321,8 +326,10 @@ static int T_dev_t(int l2, void *p) { dev_t *d = (dev_t *)p; - if (l2 != sizeof(*d)) - err(1, "T_dev_T %d != %d", l2, sizeof(*d)); + if (l2 != sizeof(*d)) { + warnx("T_dev_T %d != %d", l2, sizeof(*d)); + return (0); + } if ((int)(*d) != -1) { if (minor(*d) > 255 || minor(*d) < 0) printf("{ major = %d, minor = 0x%x }", |