[hackers] [quark] config.mk: improve feature test macros and compatibility || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Wed, 30 Aug 2017 23:31:37 +0200 (CEST)

commit 5defa985db4ffb5c78642e1d8d361c13468ba5c7
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Wed Aug 30 14:27:04 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Wed Aug 30 23:30:58 2017 +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!

diff --git a/config.mk b/config.mk
index d8f9f20..3387e74 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -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
_AT_@ -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>
_AT_@ -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;
_AT_@ -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
Received on Wed Aug 30 2017 - 23:31:37 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 30 2017 - 23:36:24 CEST