if (!isatty(0) || !isatty(1) || !isatty(2)) error_exit("no tty");
openlog("login", LOG_PID | LOG_CONS, LOG_AUTH);
- signal(SIGALRM, login_timeout_handler);
+ xsignal(SIGALRM, login_timeout_handler);
alarm(TT.login_timeout = 60);
for (ss = forbid; *ss; ss++) unsetenv(*ss);
static void timeout(int signum)
{
if (TT.wait) error_exit("Timeout");
+ // This should be xexit() but would need siglongjmp()...
exit(0);
}
static void set_alarm(int seconds)
{
- signal(SIGALRM, seconds ? timeout : SIG_DFL);
+ xsignal(SIGALRM, seconds ? timeout : SIG_DFL);
alarm(seconds);
}
if (TT.k_timeout) {
TT.k_timeout = 0;
TT.nextsig = SIGKILL;
- signal(SIGALRM, handler);
+ xsignal(SIGALRM, handler);
TT.itv.it_value = TT.ktv;
setitimer(ITIMER_REAL, &TT.itv, (void *)toybuf);
}
else {
int status;
- signal(SIGALRM, handler);
+ xsignal(SIGALRM, handler);
setitimer(ITIMER_REAL, &TT.itv, (void *)toybuf);
while (-1 == waitpid(TT.pid, &status, 0) && errno == EINTR);
toys.exitval = WIFEXITED(status)
void nohup_main(void)
{
- signal(SIGHUP, SIG_IGN);
+ xsignal(SIGHUP, SIG_IGN);
if (isatty(1)) {
close(1);
if (-1 == open("nohup.out", O_CREAT|O_APPEND|O_WRONLY,
void tee_main(void)
{
- if (toys.optflags & FLAG_i) signal(SIGINT, SIG_IGN);
+ if (toys.optflags & FLAG_i) xsignal(SIGINT, SIG_IGN);
// Open output files
loopfiles_rw(toys.optargs,