From 072ea41682be093fd5fb25e7d6669a65a76144e6 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 21 Apr 2016 18:18:05 -0700 Subject: Fix more to not append an extra newline. More's sigatexit handler needs to distinguish between normal exit and exit due to receipt of a signal. Change tty_sigreset to look at the signal number too, so that pressing 'q' to exit top doesn't cause its exit status to be 128. --- lib/xwrap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/xwrap.c') 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)); } -- cgit v1.2.3