If sysctl attempts to decode various structures that have changed
size it exits without trying to finish parsing the tree...

I'm not sure I like the following patch, but without anything better
I think it should go in...


Index: sysctl.c
===================================================================
RCS file: /home/ncvs/src/sbin/sysctl/sysctl.c,v
retrieving revision 1.45
diff -u -r1.45 sysctl.c
--- sysctl.c    8 May 2002 23:49:19 -0000       1.45
+++ sysctl.c    20 May 2002 19:56:15 -0000
@@ -275,8 +275,10 @@
 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 @@
 {
        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 @@
        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 @@
 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 }",


-- 
-Alfred Perlstein [[EMAIL PROTECTED]]
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'
Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to