[dovecot-cvs] dovecot/src/lib sendfile-util.c,1.3,1.4

cras at procontrol.fi cras at procontrol.fi
Sat Feb 8 15:52:53 EET 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv1824

Modified Files:
	sendfile-util.c 
Log Message:
FreeBSD's sendfile() works only with sockets. Replace errno with EINVAL to
make it look like sendfile isn't supported.



Index: sendfile-util.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/sendfile-util.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sendfile-util.c	14 Jan 2003 20:59:57 -0000	1.3
+++ sendfile-util.c	8 Feb 2003 13:52:51 -0000	1.4
@@ -65,8 +65,14 @@
 
 	if (ret == 0 || (ret == 0 && errno == EAGAIN && sbytes > 0))
 		return (ssize_t)sbytes;
-	else
+	else {
+		if (errno == ENOTSOCK) {
+			/* out_fd wasn't a socket. behave as if sendfile()
+			   wasn't supported at all. */
+			errno = EINVAL;
+		}
 		return -1;
+	}
 }
 
 #elif defined (HAVE_SOLARIS_SENDFILEV)




More information about the dovecot-cvs mailing list