changeset 2653:dd015282fbdf HEAD

Warning fix with Solaris.
author Timo Sirainen <tss@iki.fi>
date Wed, 22 Sep 2004 22:50:32 +0300
parents 3b24284e4e36
children b522b7cea776
files src/lib/sendfile-util.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/sendfile-util.c	Wed Sep 22 22:40:25 2004 +0300
+++ b/src/lib/sendfile-util.c	Wed Sep 22 22:50:32 2004 +0300
@@ -89,13 +89,17 @@
 ssize_t safe_sendfile(int out_fd, int in_fd, uoff_t *offset, size_t count)
 {
 	ssize_t ret;
+	off_t s_offset;
 
 	i_assert(count <= SSIZE_T_MAX);
 
 	/* NOTE: if outfd is not a socket, some Solaris versions will
 	   kernel panic */
 
-	ret = sendfile(out_fd, in_fd, offset, count);
+	s_offset = (off_t)*offset;
+	ret = sendfile(out_fd, in_fd, &s_offset, count);
+	*offset = (uoff_t)s_offset;
+
 	if (ret < 0 && errno == EAFNOSUPPORT) {
 		/* not supported, return Linux-like EINVAL so caller
 		   sees only consistent errnos. */