aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/interestingtimes.c2
-rw-r--r--lib/xwrap.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/interestingtimes.c b/lib/interestingtimes.c
index 8337ce8b..62670cbb 100644
--- a/lib/interestingtimes.c
+++ b/lib/interestingtimes.c
@@ -239,5 +239,5 @@ void tty_reset(void)
void tty_sigreset(int i)
{
tty_reset();
- _exit(128+i);
+ _exit(i ? 128+i : 0);
}
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 0b1ab8e9..36a601c5 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -47,7 +47,9 @@ void xexit(void)
// Call toys.xexit functions in reverse order added.
while (toys.xexit) {
// This is typecasting xexit->arg to a function pointer,then calling it.
- ((void (*)(void))(toys.xexit->arg))();
+ // Using the invalid signal number 0 lets the signal handlers distinguish
+ // an actual signal from a regular exit.
+ ((void (*)(int))(toys.xexit->arg))(0);
free(llist_pop(&toys.xexit));
}