tag 121701 upstream patch
thanks

Linux 2.6.5 fs/open.c source indicates that close() can return essentially any
file error:

|int filp_close(struct file *filp, fl_owner_t id)
|{
|       int retval;
|
|       /* Report and clear outstanding errors */
|       retval = filp->f_error;
|       if (retval)
|               filp->f_error = 0;
|
|[...]
|       return retval;
|}
|
|[...]
|
|asmlinkage long sys_close(unsigned int fd)
|{
|[...]
|               return filp_close(filp, files);
|[...]
|}

manpages already alludes to this ("It is quite possible that errors on
a previous write(2) operation are first reported at the final
close()."); included is a patch making it explicit.



--- -   2007-01-06 12:38:58.649694000 -0500
+++ /tmp/close.2        2007-01-06 12:38:43.121398622 -0500
@@ -31,8 +31,10 @@
 .\" Modified Fri Jan 31 16:21:46 1997 by Eric S. Raymond <[EMAIL PROTECTED]>
 .\" Modified 2000-07-22 by Nicol?s Lichtmaier <[EMAIL PROTECTED]>
 .\"   added note about close(2) not guaranteeing that data is safe on close.
+.\" Modified 2007-01-07 by Justin Pryzby <[EMAIL PROTECTED]>
+.\"   Reference errno values from write() in ERRORS
 .\"
-.TH CLOSE 2 2001-12-13 "" "Linux Programmer's Manual"
+.TH CLOSE 2 2007-01-06 "" "Linux Programmer's Manual"
 .SH NAME
 close \- close a file descriptor
 .SH SYNOPSIS
@@ -78,6 +80,12 @@
 .TP
 .B EIO
 An I/O error occurred.
+.LP
+.BR close ()
+can also fail and set
+.I errno
+to any error specified for
+.BR write ().
 .SH "CONFORMING TO"
 SVr4, 4.3BSD, POSIX.1-2001.  
 .\" SVr4 documents an additional ENOLINK error condition.

Reply via email to