NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/45456: raidctl(8): bad combination of write(2) and fflush(3)
>Number: 45456
>Category: bin
>Synopsis: raidctl(8): bad combination of write(2) and fflush(3)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 12 05:55:00 +0000 2011
>Originator: Tetsuya Isaki
>Release:
>Organization:
>Environment:
NetBSD/i386 (no uname for some reason. sorry)
>Description:
raidctl uses bad combination of write(2) and fflush(3).
The problem does not appear, but see following patch.
>How-To-Repeat:
>Fix:
RCS file: /cvsroot/src/sbin/raidctl/raidctl.c,v
retrieving revision 1.54
diff -u -r1.54 raidctl.c
--- raidctl.c 28 Sep 2011 10:29:41 -0000 1.54
+++ raidctl.c 12 Oct 2011 05:32:42 -0000
@@ -988,7 +988,6 @@
double rate;
RF_uint64 amount;
int tbit_value;
- char buffer[1024];
char bar_buffer[1024];
char eta_buffer[1024];
@@ -1049,10 +1048,8 @@
get_time_string(eta_buffer, simple_eta);
- snprintf(buffer,1024,"\r%3d%% |%s| ETA: %s %c",
+ printf("\r%3d%% |%s| ETA: %s %c",
percent_done,bar_buffer,eta_buffer,tbits[tbit_value]);
-
- write(fileno(stdout),buffer,strlen(buffer));
fflush(stdout);
if (++tbit_value>3)
Home |
Main Index |
Thread Index |
Old Index