diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-07-28 23:17:00 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-07-28 23:17:00 +0200 |
commit | 2641426187550fb2ba10f249a97e994fec26848a (patch) | |
tree | adfe6f097444fadfef38b5867e29ac30df176d64 | |
parent | fd3ac96c0f7806fbc90ff02b305b0ef51894f3db (diff) | |
download | busybox-w32-2641426187550fb2ba10f249a97e994fec26848a.tar.gz busybox-w32-2641426187550fb2ba10f249a97e994fec26848a.tar.bz2 busybox-w32-2641426187550fb2ba10f249a97e994fec26848a.zip |
logread: intercept all fatal signals, not just SIGINT
function old new delta
interrupted 27 20 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | sysklogd/logread.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sysklogd/logread.c b/sysklogd/logread.c index 993956904..2b6415f47 100644 --- a/sysklogd/logread.c +++ b/sysklogd/logread.c | |||
@@ -52,7 +52,7 @@ struct globals { | |||
52 | static void error_exit(const char *str) NORETURN; | 52 | static void error_exit(const char *str) NORETURN; |
53 | static void error_exit(const char *str) | 53 | static void error_exit(const char *str) |
54 | { | 54 | { |
55 | //release all acquired resources | 55 | /* Release all acquired resources */ |
56 | shmdt(shbuf); | 56 | shmdt(shbuf); |
57 | bb_perror_msg_and_die(str); | 57 | bb_perror_msg_and_die(str); |
58 | } | 58 | } |
@@ -66,11 +66,10 @@ static void sem_up(int semid) | |||
66 | error_exit("semop[SMrup]"); | 66 | error_exit("semop[SMrup]"); |
67 | } | 67 | } |
68 | 68 | ||
69 | static void interrupted(int sig UNUSED_PARAM) | 69 | static void interrupted(int sig) |
70 | { | 70 | { |
71 | signal(SIGINT, SIG_IGN); | ||
72 | shmdt(shbuf); | 71 | shmdt(shbuf); |
73 | exit(EXIT_SUCCESS); | 72 | kill_myself_with_sig(sig); |
74 | } | 73 | } |
75 | 74 | ||
76 | int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 75 | int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
@@ -96,7 +95,7 @@ int logread_main(int argc UNUSED_PARAM, char **argv) | |||
96 | if (log_semid == -1) | 95 | if (log_semid == -1) |
97 | error_exit("can't get access to semaphores for syslogd buffer"); | 96 | error_exit("can't get access to semaphores for syslogd buffer"); |
98 | 97 | ||
99 | signal(SIGINT, interrupted); | 98 | bb_signals(BB_FATAL_SIGS, interrupted); |
100 | 99 | ||
101 | /* Suppose atomic memory read */ | 100 | /* Suppose atomic memory read */ |
102 | /* Max possible value for tail is shbuf->size - 1 */ | 101 | /* Max possible value for tail is shbuf->size - 1 */ |