From 5defa985db4ffb5c78642e1d8d361c13468ba5c7 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Wed, 30 Aug 2017 14:27:04 +0200 Subject: [PATCH] config.mk: improve feature test macros and compatibility - add missing header netinet/in.h for socket declarations (POSIX). - rename sendfile to responsefile, sendfile(2) is a syscall on FreeBSD. - remove _XOPEN_SOURCE: this will give a warning about strptime on Linux glibc, but unbreaks the build on NetBSD and FreeBSD. thanks also to josuah and quinq for testing! --- config.mk | 2 +- quark.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.mk b/config.mk index d8f9f20..3387e74 100644 --- a/config.mk +++ b/config.mk @@ -8,7 +8,7 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man # flags -CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE +CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_BSD_SOURCE CFLAGS = -std=c99 -pedantic -Wall -Os LDFLAGS = -s diff --git a/quark.c b/quark.c index a1593a1..ef323ff 100644 --- a/quark.c +++ b/quark.c @@ -1,4 +1,5 @@ /* See LICENSE file for license details. */ +#include #include #include #include @@ -418,7 +419,7 @@ cleanup: } static enum status -sendfile(int fd, char *name, struct request *r, struct stat *st, char *mime, +responsefile(int fd, char *name, struct request *r, struct stat *st, char *mime, off_t lower, off_t upper) { FILE *fp; @@ -754,7 +755,7 @@ sendresponse(int fd, struct request *r) } } - return sendfile(fd, RELPATH(realtarget), r, &st, mime, lower, upper); + return responsefile(fd, RELPATH(realtarget), r, &st, mime, lower, upper); } static void