]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: fix sendfile use
authorKarel Zak <kzak@redhat.com>
Mon, 9 Nov 2020 14:30:06 +0000 (15:30 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 9 Nov 2020 14:30:06 +0000 (15:30 +0100)
* OSX uses different prototype
* include file is not covered by HAVE_SYS_SENDIFLE_H

Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
include/all-io.h

index 9896dfaf24c67976d842f9c36a7d56644e9c8711..a9b13c3dba30a8c76c0f9c4f15693793198352c2 100644 (file)
@@ -319,6 +319,7 @@ AC_CHECK_HEADERS([ \
        sys/socket.h \
        sys/sockio.h \
        sys/stat.h \
+       sys/sendfile.h \
        sys/sysmacros.h \
        sys/swap.h \
        sys/syscall.h \
index 2c367a42d85044a50b1221455900031c8f7b1b15..5ed2d11a2e01033db30d14b33d7e979fd4ff66d6 100644 (file)
@@ -13,8 +13,8 @@
 #include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
-#ifdef HAVE_SENDFILE
-#include <sys/sendfile.h>
+#ifdef HAVE_SYS_SENDFILE_H
+# include <sys/sendfile.h>
 #endif
 
 #include "c.h"
@@ -86,7 +86,7 @@ static inline ssize_t read_all(int fd, char *buf, size_t count)
 
 static inline ssize_t sendfile_all(int out, int in, off_t *off, size_t count)
 {
-#ifdef HAVE_SENDFILE
+#if defined(HAVE_SENDFILE) && defined(__linux__)
        ssize_t ret;
        ssize_t c = 0;
        int tries = 0;