[dovecot-cvs] dovecot/src/lib sendfile-util.c,1.5,1.6

cras at procontrol.fi cras at procontrol.fi
Thu Feb 13 10:10:38 EET 2003


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

Modified Files:
	sendfile-util.c 
Log Message:
Solaris 9 seems to kernel panic if sendfilev() is used with non-socket.



Index: sendfile-util.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/sendfile-util.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sendfile-util.c	11 Feb 2003 16:37:47 -0000	1.5
+++ sendfile-util.c	13 Feb 2003 08:10:36 -0000	1.6
@@ -82,6 +82,7 @@
 #elif defined (HAVE_SOLARIS_SENDFILEV)
 
 #include <sys/sendfile.h>
+#include "network.h"
 
 ssize_t safe_sendfile(int out_fd, int in_fd, uoff_t *offset, size_t count)
 {
@@ -90,6 +91,13 @@
 	ssize_t ret;
 
 	i_assert(count <= SSIZE_T_MAX);
+
+	/* outfd must be socket, or at least some Solaris versions will
+	   kernel panic */
+	if (net_getsockname(out_fd, NULL, NULL) < 0) {
+		errno = EINVAL;
+		return -1;
+	}
 
 	vec.sfv_fd = in_fd;
 	vec.sfv_flag = 0;




More information about the dovecot-cvs mailing list