[BusyBox 0000198]: cat does not check the return value of close(2)

bugs at busybox.net bugs at busybox.net
Mon Oct 17 07:25:11 UTC 2005


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=198 
====================================================================== 
Reported By:                farnerup
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   198
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     feedback
====================================================================== 
Date Submitted:             03-30-2005 05:13 PST
Last Modified:              10-17-2005 00:25 PDT
====================================================================== 
Summary:                    cat does not check the return value of close(2)
Description: 
cat (and possibly other programs) does not call close(2) explicitly on
stdout, and thus doesn't check if it succeded or not. This is important
for some device drivers and, I imagine, some filesystems.

# cp test /dev/foo && echo ok
cp: unable to close `/dev/foo': Input/output error
# cat test > /dev/foo && echo ok
ok

====================================================================== 

---------------------------------------------------------------------- 
 vapier - 04-15-05 22:05  
---------------------------------------------------------------------- 
this is really just Bug 107 ? 

---------------------------------------------------------------------- 
 landley - 10-14-05 18:40  
---------------------------------------------------------------------- 
Except that this doesn't tell you anything useful unless you call fsync()
too, as has been mentioned repeatedly on linux-kernel.

http://seclists.org/lists/linux-kernel/2005/Sep/3103.html

Media errors won't get reported if the data is still in cache, network
errors won't be reported if it made it into the output buffer.  So either
you want to slow down cat with an fsync, or you want to make a pedantic
change that doesn't actually mean anything.  Which is it?

Rob 

---------------------------------------------------------------------- 
 farnerup - 10-17-05 00:25  
---------------------------------------------------------------------- 
Do what you wish, I wrote a device driver that reported the error status
with the flush call and I though it was weird that the behaviour was
different for cp and cat. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
03-30-05 05:13  farnerup       New Issue                                    
04-15-05 22:05  vapier         Note Added: 0000156                          
10-14-05 18:40  landley        Note Added: 0000623                          
10-14-05 18:41  landley        Status                   assigned => feedback
10-17-05 00:25  farnerup       Note Added: 0000624                          
======================================================================




More information about the busybox-cvs mailing list