Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Dec 2003 13:46:09 +1000 (EST)
From:      Andy Farkas <andyf@speednet.com.au>
To:        "David E. O'Brien" <obrien@freebsd.org>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: bin/59220: systat(1) device select (:only) broken
Message-ID:  <20031202134151.Y16532@hewey.af.speednet.com.au>
In-Reply-To: <200312020315.hB23FbvV091846@freefall.freebsd.org>
References:  <200312020315.hB23FbvV091846@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> Responsible-Changed-From-To: freebsd-bugs->obrien
> Responsible-Changed-By: obrien
> Responsible-Changed-When: Mon Dec 1 19:15:25 PST 2003
> Responsible-Changed-Why:
> I'll take this one.

Please note that I (along with the author of the original changes) may
have been confused over the meanings of the variables tmpstr and tmpstr1
in the offending code. A simpler patch might look like this:

--- devs.c-orig Fri Nov 21 13:23:33 2003
+++ devs.c      Fri Nov 21 13:46:14 2003
@@ -280,12 +280,12 @@
                        ;
                if (*cp)
                        *cp++ = '\0';
-               if (cp - args == 0)
+               if (cp - tmpstr1 == 0)
                        break;
                for (i = 0; i < num_devices; i++) {
                        asprintf(&buffer, "%s%d", dev_select[i].device_name,
                                dev_select[i].unit_number);
-                       if (strcmp(buffer, tmpstr1) == 0) {
+                       if (strcmp(tmpstr1, buffer) == 0) {

                                num_devices_specified++;

@@ -303,8 +303,8 @@
                                free(buffer);
                }
                if (i >= num_devices)
-                       error("%s: unknown drive", args);
-               args = cp;
+                       error("%s: unknown drive", tmpstr1);
+               tmpstr1 = cp;
        }
        free(tmpstr);

--

 :{ andyf@speednet.com.au

        Andy Farkas
    System Administrator
   Speednet Communications
 http://www.speednet.com.au/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031202134151.Y16532>