Skip to content

Commit

Permalink
Fix FTBFS on GNU Hurd: define _GNU_SOURCE so unistd.h declares pipe2.
Browse files Browse the repository at this point in the history
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=/<<PKGBUILDDIR>>=. -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 <unistd.h>

       int pipe(int pipefd[2]);

       #define _GNU_SOURCE             /* See feature_test_macros(7) */
       #include <fcntl.h>              /* Definition of O_* constants */
       #include <unistd.h>

       int pipe2(int pipefd[2], int flags);
  • Loading branch information
markhindley committed Apr 23, 2023
1 parent 5cd8e06 commit 94f687e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/start-stop-daemon/start-stop-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <errno.h>
#include <fcntl.h>
Expand Down

0 comments on commit 94f687e

Please sign in to comment.