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 <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2020-08-30 11:41:45 +02:00
parent 91a51cffbe
commit 93117e5801
2 changed files with 1 additions and 2 deletions

View File

@ -31,7 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _GNU_SOURCE /* Needed with GLIBC to get asprintf() */
#include <sys/stat.h> /* utimensat() */ #include <sys/stat.h> /* utimensat() */
#include <sys/time.h> /* utimensat() on *BSD */ #include <sys/time.h> /* utimensat() on *BSD */
#include <sys/types.h> #include <sys/types.h>

View File

@ -36,7 +36,7 @@ endif
AM_CFLAGS = -W -Wall -Wextra AM_CFLAGS = -W -Wall -Wextra
AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing
AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\" -DRUNSTATEDIR=\"@runstatedir@\" 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 = syslogd.c syslogd.h socket.c socket.h syslog.h
syslogd_SOURCES += timer.c timer.h queue.h compat.h syslogd_SOURCES += timer.c timer.h queue.h compat.h