From e3af0032b236dc52d4a74c4d740e57a1f6d520aa Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 7 Nov 2009 18:55:16 +0100 Subject: set the close-on-exec flag on all file descriptors Added the "fd_util" library, which attempts to use the new thread-safe Linux system calls pipe2(), accept4() and the options O_CLOEXEC, SOCK_CLOEXEC. Without these, it falls back to FD_CLOEXEC, which is not thread safe. This is particularly important for the "pipe" output plugin (and others, such as JACK/PulseAudio), because we were heavily leaking file descriptors to child processes. --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 5f9b98111..fb2f6a916 100644 --- a/configure.ac +++ b/configure.ac @@ -115,12 +115,14 @@ fi AC_CHECK_LIB(socket,socket,MPD_LIBS="$MPD_LIBS -lsocket",) AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",) +AC_CHECK_FUNCS(pipe2 accept4) + AC_CHECK_LIB(m,exp,MPD_LIBS="$MPD_LIBS -lm",) AC_CHECK_HEADERS(locale.h) AC_CHECK_HEADERS(valgrind/memcheck.h) -AC_CHECK_FUNCS(inotify_init) +AC_CHECK_FUNCS(inotify_init inotify_init1) AC_ARG_ENABLE(inotify, AS_HELP_STRING([--disable-inotify], [disable support Inotify automatic database update (default: enabled) ]),, -- cgit v1.2.3