aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-03-10 11:07:28 -0500
committerRob Landley <rob@landley.net>2015-03-10 11:07:28 -0500
commitc776bde13bb2767db2943bc3b02df737a465c035 (patch)
tree7d8c2283641fa39248a59ecc17897ca2bd547e33
parent8a3c0edadbf915b9d2f318412587f6107a8e6d42 (diff)
downloadtoybox-c776bde13bb2767db2943bc3b02df737a465c035.tar.gz
Use xsignal() instead of signal().
-rw-r--r--toys/other/login.c2
-rw-r--r--toys/other/netcat.c3
-rw-r--r--toys/other/timeout.c4
-rw-r--r--toys/posix/nohup.c2
-rw-r--r--toys/posix/tee.c2
5 files changed, 7 insertions, 6 deletions
diff --git a/toys/other/login.c b/toys/other/login.c
index 0d6d3640..837dd977 100644
--- a/toys/other/login.c
+++ b/toys/other/login.c
@@ -156,7 +156,7 @@ void login_main(void)
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 --git a/toys/other/netcat.c b/toys/other/netcat.c
index d27aa885..453a7ca0 100644
--- a/toys/other/netcat.c
+++ b/toys/other/netcat.c
@@ -54,12 +54,13 @@ GLOBALS(
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 --git a/toys/other/timeout.c b/toys/other/timeout.c
index 6da2d2e2..06b1e89a 100644
--- a/toys/other/timeout.c
+++ b/toys/other/timeout.c
@@ -45,7 +45,7 @@ static void handler(int i)
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 @@ void timeout_main(void)
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 --git a/toys/posix/nohup.c b/toys/posix/nohup.c
index 658ab939..4d6d59f6 100644
--- a/toys/posix/nohup.c
+++ b/toys/posix/nohup.c
@@ -21,7 +21,7 @@ config NOHUP
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 --git a/toys/posix/tee.c b/toys/posix/tee.c
index 03885109..909ea58d 100644
--- a/toys/posix/tee.c
+++ b/toys/posix/tee.c
@@ -45,7 +45,7 @@ static void do_tee_open(int fd, char *name)
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,