Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154443414
D18623.id52840.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
876 B
Referenced Files
None
Subscribers
None
D18623.id52840.diff
View Options
Index: sys/kern/kern_sendfile.c
===================================================================
--- sys/kern/kern_sendfile.c
+++ sys/kern/kern_sendfile.c
@@ -1007,8 +1007,22 @@
uap->nbytes, &sbytes, uap->flags, td);
fdrop(fp, td);
- if (uap->sbytes != NULL)
- copyout(&sbytes, uap->sbytes, sizeof(off_t));
+ /*
+ * Only copy out the number of bytes if fo_sendfile did not fail, or
+ * if it failed with EAGAIN, EBUSY, or EINTR.
+ */
+ if (uap->sbytes != NULL &&
+ (error == 0 || error == EAGAIN || error == EBUSY ||
+ error == EINTR)) {
+ int copyout_error;
+
+ copyout_error = copyout(&sbytes, uap->sbytes, sizeof(off_t));
+ /*
+ * Ensure that copyout's error doesn't mask an existing error
+ * (EAGAIN, etc), if the operation was successful.
+ */
+ error = copyout_error != 0 ? copyout_error : error;
+ }
out:
free(hdr_uio, M_IOV);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 29, 2:34 PM (9 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32351851
Default Alt Text
D18623.id52840.diff (876 B)
Attached To
Mode
D18623: Address the fact that errors from `copyout(9)` are not properly percolated up on failure
Attached
Detach File
Event Timeline
Log In to Comment