{
struct command_status cstat;
sigaction_t sa;
- int pid;
+ pid_t child;
zero_bytes(&sa, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_handler = handler;
sigaction(SIGCONT, &sa, NULL);
- pid = fork();
- switch (pid) {
+ child = fork();
+ switch (child) {
case -1:
error(1, "fork");
break;
send(sv[1], &cstat, sizeof(cstat), 0);
_exit(1);
}
- return pid;
+ return child;
}
static struct signal_state {
{
if (WIFSTOPPED(status)) {
/* Child may not have privs to suspend us itself. */
- kill(getpid(), WSTOPSIG(status));
+ if (kill(getpid(), WSTOPSIG(status)) != 0)
+ warning("kill(%d, %d)", getpid(), WSTOPSIG(status));
} else {
/* Child has exited, we are done. */
cstat->type = CMD_WSTATUS;
}
}
/* Nothing listening on sv[0], send directly. */
- kill(child, signo);
+ if (kill(child, signo) != 0)
+ warning("kill(%d, %d)", child, signo);
}
}
}