mirror of
https://github.com/fluencelabs/musl
synced 2025-06-30 07:02:41 +00:00
fix usage of locks with vfork
__release_ptc() is only valid in the parent; if it's performed in the child, the lock will be unlocked early then double-unlocked later, corrupting the lock state.
This commit is contained in:
@ -35,9 +35,9 @@ int __posix_spawnx(pid_t *restrict res, const char *restrict path,
|
||||
|
||||
__acquire_ptc();
|
||||
pid = __vfork();
|
||||
__release_ptc();
|
||||
|
||||
if (pid) {
|
||||
__release_ptc();
|
||||
sigprocmask(SIG_SETMASK, &oldmask, 0);
|
||||
if (pid < 0) return -pid;
|
||||
*res = pid;
|
||||
|
Reference in New Issue
Block a user