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 /coreutils | |
| 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 'coreutils')
| -rw-r--r-- | coreutils/dd.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c index 7552c8518..961b1fff7 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
| @@ -141,7 +141,7 @@ int dd_main(int argc, char **argv) | |||
| 141 | #if ENABLE_FEATURE_DD_SIGNAL_HANDLING | 141 | #if ENABLE_FEATURE_DD_SIGNAL_HANDLING |
| 142 | sigact.sa_handler = dd_output_status; | 142 | sigact.sa_handler = dd_output_status; |
| 143 | sigact.sa_flags = SA_RESTART; | 143 | sigact.sa_flags = SA_RESTART; |
| 144 | sigemptyset(&sigact.sa_mask); | 144 | /*sigemptyset(&sigact.sa_mask); - memset did it */ |
| 145 | sigaction(SIGUSR1, &sigact, NULL); | 145 | sigaction(SIGUSR1, &sigact, NULL); |
| 146 | #endif | 146 | #endif |
| 147 | 147 | ||
| @@ -164,40 +164,40 @@ int dd_main(int argc, char **argv) | |||
| 164 | if (what == 0) | 164 | if (what == 0) |
| 165 | bb_show_usage(); | 165 | bb_show_usage(); |
| 166 | arg += key_len; | 166 | arg += key_len; |
| 167 | /* Must fit into positive ssize_t */ | ||
| 168 | #if ENABLE_FEATURE_DD_IBS_OBS | 167 | #if ENABLE_FEATURE_DD_IBS_OBS |
| 169 | if (what == OP_ibs) { | 168 | if (what == OP_ibs) { |
| 170 | ibs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes); | 169 | /* Must fit into positive ssize_t */ |
| 171 | continue; | 170 | ibs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes); |
| 172 | } | 171 | continue; |
| 173 | if (what == OP_obs) { | 172 | } |
| 174 | obs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes); | 173 | if (what == OP_obs) { |
| 175 | continue; | 174 | obs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes); |
| 176 | } | 175 | continue; |
| 177 | if (what == OP_conv) { | 176 | } |
| 178 | while (1) { | 177 | if (what == OP_conv) { |
| 179 | /* find ',', replace them with nil so we can use arg for | 178 | while (1) { |
| 180 | * index_in_strings() without copying. | 179 | /* find ',', replace them with NUL so we can use arg for |
| 181 | * We rely on arg being non-null, else strchr would fault. | 180 | * index_in_strings() without copying. |
| 182 | */ | 181 | * We rely on arg being non-null, else strchr would fault. |
| 183 | key = strchr(arg, ','); | 182 | */ |
| 184 | if (key) | 183 | key = strchr(arg, ','); |
| 185 | *key = '\0'; | 184 | if (key) |
| 186 | what = index_in_strings(keywords, arg) + 1; | 185 | *key = '\0'; |
| 187 | if (what < OP_conv_notrunc) | 186 | what = index_in_strings(keywords, arg) + 1; |
| 188 | bb_error_msg_and_die(bb_msg_invalid_arg, arg, "conv"); | 187 | if (what < OP_conv_notrunc) |
| 189 | if (what == OP_conv_notrunc) | 188 | bb_error_msg_and_die(bb_msg_invalid_arg, arg, "conv"); |
| 190 | flags |= FLAG_NOTRUNC; | 189 | if (what == OP_conv_notrunc) |
| 191 | if (what == OP_conv_sync) | 190 | flags |= FLAG_NOTRUNC; |
| 192 | flags |= FLAG_SYNC; | 191 | if (what == OP_conv_sync) |
| 193 | if (what == OP_conv_noerror) | 192 | flags |= FLAG_SYNC; |
| 194 | flags |= FLAG_NOERROR; | 193 | if (what == OP_conv_noerror) |
| 195 | if (!key) /* no ',' left, so this was the last specifier */ | 194 | flags |= FLAG_NOERROR; |
| 196 | break; | 195 | if (!key) /* no ',' left, so this was the last specifier */ |
| 197 | arg = key + 1; /* skip this keyword and ',' */ | 196 | break; |
| 198 | } | 197 | arg = key + 1; /* skip this keyword and ',' */ |
| 199 | continue; | ||
| 200 | } | 198 | } |
| 199 | continue; | ||
| 200 | } | ||
| 201 | #endif | 201 | #endif |
| 202 | if (what == OP_bs) { | 202 | if (what == OP_bs) { |
| 203 | ibs = obs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes); | 203 | ibs = obs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes); |
