From 93117e58016de6f604e67263b5135adbba032367 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 30 Aug 2020 11:41:45 +0200 Subject: [PATCH] Define _GNU_SOURCE, required for O_CLOEXEC on uClibc When building sysklogd on a uClibc system we must define _GNU_SOURCE to get O_CLOEXEC. Since _GNU_SOURCE is also required for asprintf() with GLIBC, as used by the pidfile() replacement function, we drop it from there and rely on AM_CPPFLAGS for all sources. Signed-off-by: Joachim Wiberg --- lib/pidfile.c | 1 - src/Makefile.am | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pidfile.c b/lib/pidfile.c index a26de73..886a29c 100644 --- a/lib/pidfile.c +++ b/lib/pidfile.c @@ -31,7 +31,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#define _GNU_SOURCE /* Needed with GLIBC to get asprintf() */ #include /* utimensat() */ #include /* utimensat() on *BSD */ #include diff --git a/src/Makefile.am b/src/Makefile.am index 9b80a02..1909ada 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ endif AM_CFLAGS = -W -Wall -Wextra AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\" -DRUNSTATEDIR=\"@runstatedir@\" -AM_CPPFLAGS += -D_BSD_SOURCE -D_DEFAULT_SOURCE +AM_CPPFLAGS += -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE syslogd_SOURCES = syslogd.c syslogd.h socket.c socket.h syslog.h syslogd_SOURCES += timer.c timer.h queue.h compat.h