quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

commit 5defa985db4ffb5c78642e1d8d361c13468ba5c7
parent 7e199ee04d25833383b1903f8a81e0b97f88daed
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed, 30 Aug 2017 14:27:04 +0200

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!

Diffstat:
Mconfig.mk | 2+-
Mquark.c | 5+++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git 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 @@ -1,4 +1,5 @@ /* See LICENSE file for license details. */ +#include <netinet/in.h> #include <sys/resource.h> #include <sys/socket.h> #include <sys/stat.h> @@ -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