[dovecot-cvs] dovecot/src/lib ostream-file.c,1.15,1.16 sendfile-util.c,1.6,1.7
cras at procontrol.fi
cras at procontrol.fi
Thu Apr 10 00:28:32 EEST 2003
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv32331
Modified Files:
ostream-file.c sendfile-util.c
Log Message:
Call safe_sendfile() only with sockets, and also with files under Linux.
Hopefully helps for signal 12 under FreeBSD.
Index: ostream-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/ostream-file.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- ostream-file.c 17 Mar 2003 05:09:28 -0000 1.15
+++ ostream-file.c 9 Apr 2003 20:28:30 -0000 1.16
@@ -876,6 +876,15 @@
fstream->optimal_block_size =
I_MIN(st.st_blksize, MAX_OPTIMAL_BLOCK_SIZE);
}
+#ifndef HAVE_LINUX_SENDFILE
+ /* only Linux supports sendfile() with non-sockets. Other
+ systems fail more or less gracefully if it's tried, so
+ don't bother to even try with them. */
+ fstream->no_sendfile = TRUE;
+#endif
+ } else {
+ if (net_getsockname(fd, NULL, NULL) < 0)
+ fstream->no_sendfile = TRUE;
}
return ostream;
}
Index: sendfile-util.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/sendfile-util.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sendfile-util.c 13 Feb 2003 08:10:36 -0000 1.6
+++ sendfile-util.c 9 Apr 2003 20:28:30 -0000 1.7
@@ -92,12 +92,8 @@
i_assert(count <= SSIZE_T_MAX);
- /* outfd must be socket, or at least some Solaris versions will
+ /* NOTE: if outfd is not a socket, 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