changeset 4311:d593e3094256 HEAD

Linux's sendfile() returns 0 when remote has closed connection. Convert it to EPIPE.
author Timo Sirainen <tss@iki.fi>
date Thu, 08 Jun 2006 19:51:11 +0300
parents 1a662a902b24
children 2cb75f2e25c6
files src/lib/sendfile-util.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/sendfile-util.c	Thu Jun 08 19:50:42 2006 +0300
+++ b/src/lib/sendfile-util.c	Thu Jun 08 19:51:11 2006 +0300
@@ -51,6 +51,10 @@
 	ret = sendfile(out_fd, in_fd, &safe_offset, count);
 	*offset = (uoff_t)safe_offset;
 
+	if (ret == 0) {
+		errno = EPIPE;
+		ret = -1;
+	}
 	return ret;
 }