exec: restore sigmask of child process

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
This commit is contained in:
Gao feng
2016-07-14 19:37:21 +08:00
parent c5d25b6f5f
commit 2169309145
3 changed files with 10 additions and 0 deletions
+5
View File
@@ -590,6 +590,11 @@ out:
// do the exec, no return
void hyper_exec_process(struct hyper_exec *exec)
{
if (sigprocmask(SIG_SETMASK, &orig_mask, NULL) < 0) {
perror("sigprocmask restore mask failed");
goto exit;
}
if (exec->workdir && chdir(exec->workdir) < 0) {
perror("change work directory failed");
goto exit;
+1
View File
@@ -126,4 +126,5 @@ void hyper_cleanup_pod(struct hyper_pod *pod);
extern struct hyper_pod global_pod;
extern struct hyper_ctl ctl;
extern sigset_t orig_mask;
#endif
+4
View File
@@ -37,6 +37,8 @@ struct hyper_pod global_pod = {
struct hyper_ctl ctl;
sigset_t orig_mask;
static int hyper_handle_exit(struct hyper_pod *pod);
static int hyper_stop_pod(struct hyper_pod *pod);
@@ -1120,6 +1122,8 @@ static int hyper_loop(void)
perror("sigprocmask SIGCHLD failed");
return -1;
}
// need original mask to restore sigmask of child processes
orig_mask = omask;
sigdelset(&omask, SIGCHLD);
signal(SIGCHLD, hyper_init_sigchld);