From 0d5dd415c34acbe6e154f3b0140c5a98e2892f34 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 8 May 2020 22:00:43 +0200 Subject: simply enable sendfile on linux --- Makefile | 2 +- hittpd.c | 4 ++-- 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 #endif #include @@ -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) -- cgit 1.4.1