mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-15 18:50:33 +01:00
sysdeps: Only use closefrom() if known to be async-signal-safe
closefrom() is known to be async-signal-safe on FreeBSD, NetBSD and OpenBSD, and safe to call after fork() on Solaris, but not necessarily on DragonflyBSD. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
54c62040b2
commit
faa3b2ef4a
1 changed files with 9 additions and 1 deletions
|
|
@ -4796,7 +4796,15 @@ act_on_fds_3_and_up (void (*func) (int fd))
|
|||
void
|
||||
_dbus_close_all (void)
|
||||
{
|
||||
#ifdef HAVE_CLOSEFROM
|
||||
/* Some library implementations of closefrom() are not async-signal-safe,
|
||||
* and we call _dbus_close_all() after forking, so we only do this on
|
||||
* operating systems where we know that closefrom() is a system call */
|
||||
#if defined(HAVE_CLOSEFROM) && ( \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__sun__) && defined(F_CLOSEFROM) \
|
||||
)
|
||||
closefrom (3);
|
||||
#else
|
||||
act_on_fds_3_and_up (close_ignore_error);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue