bin/59220: systat(1) device select (:only) broken

Andy Farkas andyf at speednet.com.au
Mon Dec 1 19:46:14 PST 2003


> 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 at speednet.com.au

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




More information about the freebsd-bugs mailing list