NetBSD-Bugs archive

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

bin/39574: /bin/echo always exits zero even when it encounters I/O errors



>Number:         39574
>Category:       bin
>Synopsis:       /bin/echo always exits zero even when it encounters I/O errors
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 17 22:25:00 +0000 2008
>Originator:     Ed Ravin
>Release:        4.0
>Organization:
Public Access Networks Corp
>Environment:
NetBSD panix5.panix.com 4.0 NetBSD 4.0 (PANIX-XEN3U-USER) #1: Tue Apr  1 
23:24:49 EDT 2008  
root%juggler.panix.com@localhost:/misc2/obj/misc2/devel/netbsd/4.0/src/sys/arch/i386/compile/PANIX-XEN3U-USER
 i386

>Description:
We are having trouble with a shell script that loops on stdin, prompting users 
for information, that goes into infinite loop when the tty is revoked.

One of the problems seems to be that /bin/echo always exits with zero, even if 
it encounters I/O errors trying to write to stdout.  This is bad practice, and 
it also contravenes the documentation:

   EXIT STATUS
   The echo utility exits 0 on success, and >0 if an error occurs.


>How-To-Repeat:
Confirmed by reading src/bin/echo.c (a very short program) that the return 
value from printf() and putchar() is never checked and that it always exits 
with zero.
>Fix:



Home | Main Index | Thread Index | Old Index