From 94f687eec9fcf3a54bc590af6dfcf64237871197 Mon Sep 17 00:00:00 2001 From: Mark Hindley Date: Sun, 23 Apr 2023 16:29:06 +0100 Subject: [PATCH] Fix FTBFS on GNU Hurd: define _GNU_SOURCE so unistd.h declares pipe2. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FAILED: src/start-stop-daemon/start-stop-daemon.p/start-stop-daemon.c.o cc -Isrc/start-stop-daemon/start-stop-daemon.p -Isrc/start-stop-daemon -I../src/start-stop-daemon -Isrc/shared -I../src/shared -Isrc/libeinfo -I../src/libeinfo -Isrc/librc -I../src/librc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=c99 -D_DEFAULT_SOURCE -DMAXPATHLEN=4096 -DPATH_MAX=4096 -Wcast-align -Wcast-qual -Wdeclaration-after-statement -Wformat=2 -Winline -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wsequence-point -Wshadow -Wwrite-strings -Werror=implicit-function-declaration -DHAVE_MALLOC_EXTENDED_ATTRIBUTE -DHAVE_CLOSEFROM -DHAVE_CLOSE_RANGE_CLOEXEC -g -O2 -ffile-prefix-map=/<>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -MD -MQ src/start-stop-daemon/start-stop-daemon.p/start-stop-daemon.c.o -MF src/start-stop-daemon/start-stop-daemon.p/start-stop-daemon.c.o.d -o src/start-stop-daemon/start-stop-daemon.p/start-stop-daemon.c.o -c ../src/start-stop-daemon/start-stop-daemon.c ../src/start-stop-daemon/start-stop-daemon.c: In function ‘main’: ../src/start-stop-daemon/start-stop-daemon.c:865:13: error: implicit declaration of function ‘pipe2’; did you mean ‘pipe’? [-Werror=implicit-function-declaration] 865 | if (pipe2(pipefd, O_CLOEXEC) == -1) | ^~~~~ | pipe Although this is triggered on HURD, according to glibc pipe2(2), this is required for the 2 argument form irresepctive of arch. SYNOPSIS #include int pipe(int pipefd[2]); #define _GNU_SOURCE /* See feature_test_macros(7) */ #include /* Definition of O_* constants */ #include int pipe2(int pipefd[2], int flags); --- src/start-stop-daemon/start-stop-daemon.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/start-stop-daemon/start-stop-daemon.c b/src/start-stop-daemon/start-stop-daemon.c index ef6f454eb..142326601 100644 --- a/src/start-stop-daemon/start-stop-daemon.c +++ b/src/start-stop-daemon/start-stop-daemon.c @@ -21,10 +21,8 @@ #define ONE_MS 1000000 -#ifdef __linux__ -/* For extra SCHED_* defines. */ +/* For extra SCHED_* defines and pipe2. */ # define _GNU_SOURCE -#endif #include #include