mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-08-19 04:17:40 +00:00
exec: restore sigmask of child process
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user