diff options
-rw-r--r-- | cmake/ConfigureChecks.cmake | 1 | ||||
-rw-r--r-- | cmake/config.h.cmake | 3 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | dbus/dbus-sysdeps-unix.c | 4 |
4 files changed, 9 insertions, 0 deletions
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 98f27db7..78b0fa95 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -52,6 +52,7 @@ check_symbol_exists(getpwnam_r "errno.h;pwd.h" HAVE_GETPWNAM_R) # check_symbol_exists(setenv "stdlib.h" HAVE_SETENV) # dbus-sysdeps.c check_symbol_exists(unsetenv "stdlib.h" HAVE_UNSETENV) # dbus-sysdeps.c check_symbol_exists(clearenv "stdlib.h" HAVE_CLEARENV) # dbus-sysdeps.c +check_symbol_exists(closefrom "unistd.h" HAVE_CLOSEFROM) # dbus-sysdeps-unix.c check_symbol_exists(writev "sys/uio.h" HAVE_WRITEV) # dbus-sysdeps.c, dbus-sysdeps-win.c check_symbol_exists(setrlimit "sys/resource.h" HAVE_SETRLIMIT) # dbus-sysdeps.c, dbus-sysdeps-win.c, test/test-segfault.c check_symbol_exists(socketpair "sys/socket.h" HAVE_SOCKETPAIR) # dbus-sysdeps.c diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 06bb34fd..48c5db43 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -201,6 +201,9 @@ /* Define to 1 if you have clearenv */ #cmakedefine HAVE_CLEARENV 1 +/* Define to 1 if you have closefrom */ +#cmakedefine HAVE_CLOSEFROM 1 + /* Define to 1 if you have writev */ #cmakedefine HAVE_WRITEV 1 diff --git a/configure.ac b/configure.ac index 6d4f3081..dbaf14b7 100644 --- a/configure.ac +++ b/configure.ac @@ -382,6 +382,7 @@ AS_IF([test x$enable_code_coverage = xyes],[ AC_CHECK_FUNCS_ONCE([ accept4 clearenv +closefrom fpathconf getgrouplist getpeereid diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 1c4d0f6f..273f3f06 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -4796,7 +4796,11 @@ act_on_fds_3_and_up (void (*func) (int fd)) void _dbus_close_all (void) { +#ifdef HAVE_CLOSEFROM + closefrom (3); +#else act_on_fds_3_and_up (close_ignore_error); +#endif } /** |