diff --git a/Makefile b/Makefile index 29ebef0..64a0482 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ B64_OBJS?=src/b64/cencode.o FORMAT_OBJS?=src/formats/json.o src/formats/raw.o src/formats/common.o src/formats/custom-type.o HTTP_PARSER_OBJS?=src/http-parser/http_parser.o -CFLAGS ?= -Wall -Wextra -Isrc -Isrc/jansson/src -Isrc/http-parser -MD +CFLAGS ?= -std=c99 -Wall -Wextra -Isrc -Isrc/jansson/src -Isrc/http-parser -MD -D_POSIX_C_SOURCE=200809L -Wno-pragmas LDFLAGS ?= -levent -pthread # Pass preprocessor macros to the compile invocation diff --git a/src/acl.c b/src/acl.c index 160e6e5..61d1b5e 100644 --- a/src/acl.c +++ b/src/acl.c @@ -5,6 +5,7 @@ #include "client.h" #include +#include #include #include #include diff --git a/src/client.c b/src/client.c index 353b360..c54fab8 100644 --- a/src/client.c +++ b/src/client.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include diff --git a/src/cmd.c b/src/cmd.c index 937e6ca..a77e079 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include diff --git a/src/conf.c b/src/conf.c index 904356e..2644d89 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include diff --git a/src/formats/json.c b/src/formats/json.c index 0cbcb52..833e7b1 100644 --- a/src/formats/json.c +++ b/src/formats/json.c @@ -5,6 +5,7 @@ #include "client.h" #include +#include #include #include diff --git a/src/formats/msgpack.c b/src/formats/msgpack.c index a3190b7..0a6606e 100644 --- a/src/formats/msgpack.c +++ b/src/formats/msgpack.c @@ -5,6 +5,7 @@ #include "client.h" #include +#include #include #include diff --git a/src/hiredis/fmacros.h b/src/hiredis/fmacros.h index 3227faa..6da4238 100644 --- a/src/hiredis/fmacros.h +++ b/src/hiredis/fmacros.h @@ -2,7 +2,9 @@ #define __HIREDIS_FMACRO_H #define _XOPEN_SOURCE 600 +#ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112L +#endif #if defined(__APPLE__) && defined(__MACH__) /* Enable TCP_KEEPALIVE */ diff --git a/src/http.c b/src/http.c index 9da29e1..89bd942 100644 --- a/src/http.c +++ b/src/http.c @@ -5,6 +5,7 @@ #include "slog.h" #include +#include #include #include #include diff --git a/src/server.c b/src/server.c index 03fa3b9..be39792 100644 --- a/src/server.c +++ b/src/server.c @@ -200,7 +200,7 @@ server_daemonize(struct server *s, const char *pidfile) { /* write pidfile */ if(pidfile) { - int pid_fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600); + int pid_fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC, 0600); if(pid_fd > 0) { char pid_buffer[(CHAR_BIT * sizeof(int) / 3) + 3]; /* max length for int */ int pid_sz = snprintf(pid_buffer, sizeof(pid_buffer), "%d\n", (int)getpid());