mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-02-04 22:20:30 +01:00
disable fork-malloc-exec for non-glibc-systems
Calling malloc() after fork is undefined behaviour if the process is
multi-threaded. locks held by a thread on fork() will never be released.
malloc() is usally protected by a lock and can therefore deadlock. glibc
is known not to deadlock in this case.
This commit does not rule out other problems on glibc-systems, but fixes an
issue on musl-libc-systems. Only restricting to async-signal safe functions
between fork() and exec() prevents undefined behaviour for sure. See
signal-safety(7).
(cherry picked from commit 3fab06d68f)
This commit is contained in:
parent
ac6e6cb68a
commit
d13349f25c
1 changed files with 1 additions and 1 deletions
|
|
@ -4471,7 +4471,7 @@ _dbus_close_all (void)
|
|||
{
|
||||
int maxfds, i;
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) && defined(__GLIBC__)
|
||||
DIR *d;
|
||||
|
||||
/* On Linux we can optimize this a bit if /proc is available. If it
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue