From 9ac254da7dc4cc95a3f3aad5eb53bfa881e52ae6 Mon Sep 17 00:00:00 2001 From: "Bruce A. Mah" Date: Tue, 15 Apr 2014 02:51:54 -0700 Subject: [PATCH] Fix build on systems without sendfile(2). Tested on: OpenBSD 5.4 --- src/net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/net.c b/src/net.c index 6411962..67e19f0 100644 --- a/src/net.c +++ b/src/net.c @@ -268,7 +268,6 @@ Nsendfile(int fromfd, int tofd, const char *buf, size_t count) #endif #endif #endif -#endif /* HAVE_SENDFILE */ if (r < 0) { switch (errno) { case EINTR: @@ -287,6 +286,10 @@ Nsendfile(int fromfd, int tofd, const char *buf, size_t count) nleft -= r; } return count; +#else /* HAVE_SENDFILE */ + errno = ENOSYS; /* error if somehow get called without HAVE_SENDFILE */ + return -1; +#endif /* HAVE_SENDFILE */ } /*************************************************************************/