Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/raidctl PR/45456: Tetsuya Isaki: Don't mix stdio and wr...



details:   https://anonhg.NetBSD.org/src/rev/e3c9867a0fe3
branches:  trunk
changeset: 770327:e3c9867a0fe3
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Oct 12 16:45:37 2011 +0000

description:
PR/45456: Tetsuya Isaki: Don't mix stdio and write.

diffstat:

 sbin/raidctl/raidctl.c |  11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diffs (39 lines):

diff -r 4a252e003336 -r e3c9867a0fe3 sbin/raidctl/raidctl.c
--- a/sbin/raidctl/raidctl.c    Wed Oct 12 16:41:47 2011 +0000
+++ b/sbin/raidctl/raidctl.c    Wed Oct 12 16:45:37 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: raidctl.c,v 1.54 2011/09/28 10:29:41 mrg Exp $   */
+/*      $NetBSD: raidctl.c,v 1.55 2011/10/12 16:45:37 christos Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: raidctl.c,v 1.54 2011/09/28 10:29:41 mrg Exp $");
+__RCSID("$NetBSD: raidctl.c,v 1.55 2011/10/12 16:45:37 christos Exp $");
 #endif
 
 
@@ -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",
-                        percent_done,bar_buffer,eta_buffer,tbits[tbit_value]);
-
-               write(fileno(stdout),buffer,strlen(buffer));
+               fprintf(stdout,"\r%3d%% |%s| ETA: %s %c",
+                       percent_done,bar_buffer,eta_buffer,tbits[tbit_value]);
                fflush(stdout);
 
                if (++tbit_value>3) 



Home | Main Index | Thread Index | Old Index