lib9: restore SIGCHLD handler in rfork
R=rsc http://codereview.appspot.com/4436071
This commit is contained in:
parent
f444695a2a
commit
333482548d
1 changed files with 5 additions and 6 deletions
|
|
@ -18,6 +18,9 @@ p9rfork(int flags)
|
||||||
int n;
|
int n;
|
||||||
char buf[128], *q;
|
char buf[128], *q;
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
struct sigaction oldchld;
|
||||||
|
|
||||||
|
memset(&oldchld, 0, sizeof oldchld);
|
||||||
|
|
||||||
if((flags&(RFPROC|RFFDG|RFMEM)) == (RFPROC|RFFDG)){
|
if((flags&(RFPROC|RFFDG|RFMEM)) == (RFPROC|RFFDG)){
|
||||||
/* check other flags before we commit */
|
/* check other flags before we commit */
|
||||||
|
|
@ -28,12 +31,7 @@ p9rfork(int flags)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(flags&RFNOWAIT){
|
if(flags&RFNOWAIT){
|
||||||
/*
|
sigaction(SIGCHLD, nil, &oldchld);
|
||||||
* BUG - should put the signal handler back after we
|
|
||||||
* finish, but I just don't care. If a program calls with
|
|
||||||
* NOWAIT once, they're not likely to want child notes
|
|
||||||
* after that.
|
|
||||||
*/
|
|
||||||
signal(SIGCHLD, nop);
|
signal(SIGCHLD, nop);
|
||||||
if(pipe(p) < 0)
|
if(pipe(p) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -97,6 +95,7 @@ p9rfork(int flags)
|
||||||
close(p[1]);
|
close(p[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sigaction(SIGCHLD, &oldchld, nil);
|
||||||
}
|
}
|
||||||
if(pid != 0)
|
if(pid != 0)
|
||||||
return pid;
|
return pid;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue