mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-08 17:18:27 +02:00
Use closefrom() to not loop over all possible file descriptors
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/278
This commit is contained in:
parent
a6154cb8ef
commit
54c62040b2
4 changed files with 9 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -382,6 +382,7 @@ AS_IF([test x$enable_code_coverage = xyes],[
|
|||
AC_CHECK_FUNCS_ONCE([
|
||||
accept4
|
||||
clearenv
|
||||
closefrom
|
||||
fpathconf
|
||||
getgrouplist
|
||||
getpeereid
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue