Skip to content

Commit 584fd91

Browse files
committed
init: only use pipe2 if availabile, check in configure
1 parent 828bb77 commit 584fd91

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,8 @@ AC_CHECK_DECLS([strnlen])
925925
dnl Check for daemon(3), unrelated to --with-daemon (although used by it)
926926
AC_CHECK_DECLS([daemon])
927927

928+
AC_CHECK_DECLS([pipe2])
929+
928930
AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,,
929931
[#if HAVE_ENDIAN_H
930932
#include <endian.h>

src/shutdown.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static int g_shutdown_pipe[2] = {-1, -1};
3232
bool InitShutdownState()
3333
{
3434
#ifndef WIN32
35-
#if HAVE_O_CLOEXEC
35+
#if HAVE_O_CLOEXEC && HAVE_DECL_PIPE2
3636
// If we can, make sure that the file descriptors are closed on exec()
3737
// to prevent interference.
3838
if (pipe2(g_shutdown_pipe, O_CLOEXEC) != 0) {

0 commit comments

Comments
 (0)