2
0
mirror of git://sourceware.org/git/glibc.git synced 2025-04-24 14:41:06 +08:00

posix: Do not clobber errno by atfork handlers

Checked on x86_64-linux-gnu.
This commit is contained in:
Adhemerval Zanella 2021-01-21 10:20:54 -03:00
parent 9a75654037
commit d0c4083386

@ -103,6 +103,9 @@ __libc_fork (void)
}
else
{
/* If _Fork failed, preserve its errno value. */
int save_errno = errno;
/* Release acquired locks in the multi-threaded case. */
if (multiple_threads)
{
@ -115,6 +118,9 @@ __libc_fork (void)
/* Run the handlers registered for the parent. */
__run_fork_handlers (atfork_run_parent, multiple_threads);
if (pid < 0)
__set_errno (save_errno);
}
return pid;