summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-05-08 22:00:43 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-05-08 22:00:43 +0200
commit0d5dd415c34acbe6e154f3b0140c5a98e2892f34 (patch)
tree608c6e864c6ab889244ffa05ec4eb9b997f5ae5d
parentc724fd1ba192189f96ea8990f3792bd11a25cbd2 (diff)
downloadhittpd-0d5dd415c34acbe6e154f3b0140c5a98e2892f34.tar.gz
hittpd-0d5dd415c34acbe6e154f3b0140c5a98e2892f34.tar.xz
hittpd-0d5dd415c34acbe6e154f3b0140c5a98e2892f34.zip
simply enable sendfile on linux
-rw-r--r--Makefile2
-rw-r--r--hittpd.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index fbe0a26..f2a101e 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ ALL=hittpd
 OBJ=hittpd.o http-parser/http_parser.o
 
 CFLAGS=-g -O2 -Wall -Wno-switch -Wextra -Wwrite-strings
-CPPFLAGS=-DUSE_SENDFILE -Ihttp-parser
+CPPFLAGS=-Ihttp-parser
 
 DESTDIR=
 PREFIX=/usr/local
diff --git a/hittpd.c b/hittpd.c
index e64cbff..abf793e 100644
--- a/hittpd.c
+++ b/hittpd.c
@@ -26,7 +26,7 @@
 #define _XOPEN_SOURCE 700
 #define _DEFAULT_SOURCE
 
-#ifdef USE_SENDFILE
+#ifdef __linux__
 #include <sys/sendfile.h>
 #endif
 #include <sys/socket.h>
@@ -791,7 +791,7 @@ write_client(int i)
 	ssize_t w = 0;
 
 	if (data->stream_fd >= 0) {
-#ifndef USE_SENDFILE
+#ifndef __linux__
 		char buf[16*4096];
 		size_t n = pread(data->stream_fd, buf, sizeof buf, data->off);
 		if (n < 0)