From 05f168fc512625e17e5925e174bcaf2bb65c577e Mon Sep 17 00:00:00 2001 From: Nicolas Favre-Felix Date: Thu, 23 Feb 2023 06:46:19 -0800 Subject: [PATCH] Define _POSIX_C_SOURCE=200809L This is needed to enable localtime_r(3) used in src/slog.c Also needed for strdup(3) Add #ifndef to src/hiredis/fmacros.h to avoid warnings --- Makefile | 2 +- src/hiredis/fmacros.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 312cf5d..bfa0bed 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 ?= -std=c99 -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 LDFLAGS ?= -levent -pthread # Pass preprocessor macros to the compile invocation 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 */