NetBSD Problem Report #45456

From www@NetBSD.org  Wed Oct 12 05:52:02 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 5437E63D4F6
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 12 Oct 2011 05:52:02 +0000 (UTC)
Message-Id: <20111012055201.B646763B955@www.NetBSD.org>
Date: Wed, 12 Oct 2011 05:52:01 +0000 (UTC)
From: isaki@pastel-flower.jp
Reply-To: isaki@pastel-flower.jp
To: gnats-bugs@NetBSD.org
Subject: raidctl(8): bad combination of write(2) and fflush(3)
X-Send-Pr-Version: www-1.0

>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:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 12 05:55:00 +0000 2011
>Closed-Date:    Sat Nov 05 17:29:47 +0000 2011
>Last-Modified:  Sat Nov 05 17:29:47 +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) 

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45456 CVS commit: src/sbin/raidctl
Date: Wed, 12 Oct 2011 12:45:37 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Wed Oct 12 16:45:37 UTC 2011

 Modified Files:
 	src/sbin/raidctl: raidctl.c

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


 To generate a diff of this commit:
 cvs rdiff -u -r1.54 -r1.55 src/sbin/raidctl/raidctl.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 05 Nov 2011 17:29:47 +0000
State-Changed-Why:
fixed, thanks


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.