diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-24 13:36:01 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-24 13:36:01 +0000 |
commit | 400d8bb45ee25ce226bb343a3dfaab84e6d3a8e1 (patch) | |
tree | aa3cdc9a663f1ac2467803fc215899d86ed1db74 /miscutils | |
parent | d553faf5a53cf9d72e16fc789451a92a797f1b70 (diff) | |
download | busybox-w32-400d8bb45ee25ce226bb343a3dfaab84e6d3a8e1.tar.gz busybox-w32-400d8bb45ee25ce226bb343a3dfaab84e6d3a8e1.tar.bz2 busybox-w32-400d8bb45ee25ce226bb343a3dfaab84e6d3a8e1.zip |
less,klogd,syslogd,nc,tcpudp: exit on signal by killing itself, not exit(1)
*: minor shrink
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/less.c | 8 | ||||
-rw-r--r-- | miscutils/rx.c | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index f3be2cfbf..7351a634d 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -174,7 +174,9 @@ static void less_exit(int code) | |||
174 | { | 174 | { |
175 | bb_putchar('\n'); | 175 | bb_putchar('\n'); |
176 | set_tty_cooked(); | 176 | set_tty_cooked(); |
177 | exit(code); /* TODO: "suicide mode" for code == -signal */ | 177 | if (code < 0) |
178 | kill_myself_with_sig(- code); /* does not return */ | ||
179 | exit(code); | ||
178 | } | 180 | } |
179 | 181 | ||
180 | /* Move the cursor to a position (x,y), where (0,0) is the | 182 | /* Move the cursor to a position (x,y), where (0,0) is the |
@@ -1328,9 +1330,9 @@ static void keypress_process(int keypress) | |||
1328 | number_process(keypress); | 1330 | number_process(keypress); |
1329 | } | 1331 | } |
1330 | 1332 | ||
1331 | static void sig_catcher(int sig ATTRIBUTE_UNUSED) | 1333 | static void sig_catcher(int sig) |
1332 | { | 1334 | { |
1333 | less_exit(1) /* TODO: "suicide mode" for code == -signal */ | 1335 | less_exit(- sig); |
1334 | } | 1336 | } |
1335 | 1337 | ||
1336 | int less_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 1338 | int less_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
diff --git a/miscutils/rx.c b/miscutils/rx.c index 898703c59..8ccea4974 100644 --- a/miscutils/rx.c +++ b/miscutils/rx.c | |||
@@ -43,7 +43,7 @@ Cf: | |||
43 | #define TIMEOUT_LONG 10 | 43 | #define TIMEOUT_LONG 10 |
44 | #define MAXERRORS 10 | 44 | #define MAXERRORS 10 |
45 | 45 | ||
46 | static int read_byte(int fd, unsigned int timeout) | 46 | static int read_byte(int fd, unsigned timeout) |
47 | { | 47 | { |
48 | char buf[1]; | 48 | char buf[1]; |
49 | int n; | 49 | int n; |