Date: Thu, 13 Nov 2003 02:06:18 +1000 (EST) From: Andy Farkas <andyf@speednet.com.au> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/59220: systat(1) device select (:only) broken Message-ID: <200311121606.hACG6IXb083533@hewey.af.speednet.com.au> Resent-Message-ID: <200311121610.hACGAO41067052@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 59220 >Category: bin >Synopsis: systat(1) device select (:only) broken >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Nov 12 08:10:23 PST 2003 >Closed-Date: >Last-Modified: >Originator: Andy Farkas >Release: FreeBSD 5.1-CURRENT i386 >Organization: >Environment: File: src/usr.bin/systat/devs.c Revision 1.6, Wed Dec 12 00:13:37 2001 UTC (23 months ago) by markm Branch: MAIN CVS Tags: RELENG_5_0_BP, RELENG_5_0_0_RELEASE, RELENG_5_0 Changes since 1.5: +37 -30 lines WARNS=2 fixes with NO_WERROR set, as there are some header issues with namelists. use __FBSDID(). >Description: systat(1) :only option is supposed to accept multiple drives. Its been broken for almost 2 years! >How-To-Repeat: systat -v [type ":only da0 da1"] >Fix: This works for me, although it may be wrong: diff -u ./devs.c-orig ./devs.c --- ./devs.c-orig Tue Oct 21 06:13:50 2003 +++ ./devs.c Thu Nov 13 01:25:45 2003 @@ -269,23 +269,24 @@ specified_devices = (char **)malloc(sizeof(char *)); tmpstr = tmpstr1 = strdup(args); - cp = index(tmpstr1, '\n'); + cp = index(tmpstr, '\n'); if (cp) *cp = '\0'; + for (;;) { - for (cp = tmpstr1; *cp && isspace(*cp); cp++) + for (cp = tmpstr; *cp && isspace(*cp); cp++) ; - tmpstr1 = cp; + tmpstr = cp; for (; *cp && !isspace(*cp); cp++) ; if (*cp) *cp++ = '\0'; - if (cp - args == 0) + if (cp - tmpstr == 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(tmpstr, buffer) == 0) { num_devices_specified++; @@ -294,7 +295,7 @@ sizeof(char *) * num_devices_specified); specified_devices[num_devices_specified -1]= - strdup(tmpstr1); + strdup(tmpstr); free(buffer); break; @@ -303,10 +304,10 @@ free(buffer); } if (i >= num_devices) - error("%s: unknown drive", args); - args = cp; + error("%s: unknown drive", tmpstr); + tmpstr = cp; } - free(tmpstr); + free(tmpstr1); if (num_devices_specified > 0) { last_type = DS_MATCHTYPE_SPEC; >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311121606.hACG6IXb083533>