# HG changeset patch # User Rob Landley # Date 1426003648 18000 # Node ID c0ef9b7976f0b1d4f5ffb3eab92d8319eb610701 # Parent 26170eb7685d4016c68104aefd5d12aafbfa483f Use xsignal() instead of signal(). diff -r 26170eb7685d -r c0ef9b7976f0 toys/other/login.c --- a/toys/other/login.c Mon Mar 09 15:06:10 2015 -0500 +++ b/toys/other/login.c Tue Mar 10 11:07:28 2015 -0500 @@ -156,7 +156,7 @@ 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); diff -r 26170eb7685d -r c0ef9b7976f0 toys/other/netcat.c --- a/toys/other/netcat.c Mon Mar 09 15:06:10 2015 -0500 +++ b/toys/other/netcat.c Tue Mar 10 11:07:28 2015 -0500 @@ -54,12 +54,13 @@ 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); } diff -r 26170eb7685d -r c0ef9b7976f0 toys/other/timeout.c --- a/toys/other/timeout.c Mon Mar 09 15:06:10 2015 -0500 +++ b/toys/other/timeout.c Tue Mar 10 11:07:28 2015 -0500 @@ -45,7 +45,7 @@ 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); } @@ -66,7 +66,7 @@ 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) diff -r 26170eb7685d -r c0ef9b7976f0 toys/posix/nohup.c --- a/toys/posix/nohup.c Mon Mar 09 15:06:10 2015 -0500 +++ b/toys/posix/nohup.c Tue Mar 10 11:07:28 2015 -0500 @@ -21,7 +21,7 @@ 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, diff -r 26170eb7685d -r c0ef9b7976f0 toys/posix/tee.c --- a/toys/posix/tee.c Mon Mar 09 15:06:10 2015 -0500 +++ b/toys/posix/tee.c Tue Mar 10 11:07:28 2015 -0500 @@ -45,7 +45,7 @@ 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,