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:
parent
ebee8c2b47
commit
599f973603
3 changed files with 4 additions and 3 deletions
|
|
@ -38,9 +38,9 @@ FILE *popen(const char *cmd, const char *mode)
|
|||
|
||||
__acquire_ptc();
|
||||
pid = __vfork();
|
||||
__release_ptc();
|
||||
|
||||
if (pid) {
|
||||
__release_ptc();
|
||||
__syscall(SYS_close, p[1-op]);
|
||||
sigprocmask(SIG_BLOCK, SIGALL_SET, &old);
|
||||
if (pid < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue