]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/write.2
write.2: RETURN VALUE: clarify details of partial write and
[thirdparty/man-pages.git] / man2 / write.2
index d6e14aaf0af02126e91e2f07bd67bac1cbac4b38..5118a1550097f7e926e61ee89ba1041ca7252b74 100644 (file)
@@ -94,14 +94,27 @@ is greater than
 the result is implementation-defined;
 see NOTES for the upper limit on Linux.
 .SH RETURN VALUE
-On success, the number of bytes written is returned (zero indicates
-nothing was written).
-It is not an error if this number is smaller than the number of bytes
-requested; this may happen for example because the disk device was filled.
-See also NOTES.
-.PP
+On success, the number of bytes written is returned.
 On error, \-1 is returned, and \fIerrno\fP is set
-appropriately.
+to indicate the cause of the error.
+.PP
+Note that a successful
+.BR write ()
+may transfer fewer than
+.I count
+bytes.
+Such partial writes can occur for various reasons;
+for example, because there was insufficient space on the disk device
+to write all of the requested bytes, or because a blocked
+.BR write ()
+to a socket, pipe, or similar was interrupted by a signal handler
+after it had transferred some, but before it had transferred all
+of the requested bytes.
+In the event of a partial write, the caller can make another
+.BR write ()
+call to transfer the remaining bytes.
+The subsequent call will either transfer further bytes or
+may result in an error (e.g., if the disk is now full).
 .PP
 If \fIcount\fP is zero and
 .I fd