[PATCH] resize, showkey, watchdog, more: Use _exit() instead of exit() in sighandlers

Marek Polacek mmpolacek at gmail.com
Wed Oct 27 21:57:54 UTC 2010


I've found more inappropriate exit()s in sighandlers.  Here's a patch to
change them into _exit()s.

Oh, and Denys, sorry for the broken tabs/spaces patch.  I've already
slapped myself twice.  This one should be OK.

Signed-off-by: Marek Polacek <mmpolacek at gmail.com>
---
 console-tools/resize.c  |    2 +-
 console-tools/showkey.c |    2 +-
 miscutils/watchdog.c    |    2 +-
 util-linux/more.c       |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/console-tools/resize.c b/console-tools/resize.c
index 12e50a1..fdfe2a6 100644
--- a/console-tools/resize.c
+++ b/console-tools/resize.c
@@ -17,7 +17,7 @@ static void
 onintr(int sig UNUSED_PARAM)
 {
 	tcsetattr(STDERR_FILENO, TCSANOW, old_termios_p);
-	exit(EXIT_FAILURE);
+	_exit(EXIT_FAILURE);
 }

 int resize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/console-tools/showkey.c b/console-tools/showkey.c
index 149ea64..1fa0a7e 100644
--- a/console-tools/showkey.c
+++ b/console-tools/showkey.c
@@ -50,7 +50,7 @@ static void signal_handler(int signo)
 	xset1(&tio0);
 	xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)kbmode);
 	// alarmed? -> exit 0
-	exit(SIGALRM == signo);
+	_exit(SIGALRM == signo);
 }

 int showkey_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index 3325396..f3316e7 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -24,7 +24,7 @@ static void watchdog_shutdown(int sig UNUSED_PARAM)
 	write(3, &V, 1);	/* Magic, see watchdog-api.txt in kernel */
 	if (ENABLE_FEATURE_CLEAN_UP)
 		close(3);
-	exit(EXIT_SUCCESS);
+	_exit(EXIT_SUCCESS);
 }

 int watchdog_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/util-linux/more.c b/util-linux/more.c
index 1fd6f9e..734ec52 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -38,7 +38,7 @@ static void gotsig(int sig UNUSED_PARAM)
 {
 	bb_putchar('\n');
 	setTermSettings(cin_fileno, &initial_settings);
-	exit(EXIT_FAILURE);
+	_exit(EXIT_FAILURE);
 }

 #define CONVERTED_TAB_SIZE 8
-- 
1.7.3.2





More information about the busybox mailing list