diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-11-11 22:59:41 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-11-11 22:59:41 +0000 |
commit | f91f14d2211148ade28270572b9c45023f9b6580 (patch) | |
tree | 8b8d9060a9f5c68694f494a4bcbfce9338dc1c65 /coreutils/cksum.c | |
parent | 0d8736772d3dda40852c552edfbc649a3494d2fa (diff) | |
download | busybox-w32-f91f14d2211148ade28270572b9c45023f9b6580.tar.gz busybox-w32-f91f14d2211148ade28270572b9c45023f9b6580.tar.bz2 busybox-w32-f91f14d2211148ade28270572b9c45023f9b6580.zip |
cksum, printenv: report errors via exitcode
function old new delta
cksum_main 296 315 +19
printenv_main 74 86 +12
Diffstat (limited to 'coreutils/cksum.c')
-rw-r--r-- | coreutils/cksum.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/coreutils/cksum.c b/coreutils/cksum.c index 546532c3c..3a77c753a 100644 --- a/coreutils/cksum.c +++ b/coreutils/cksum.c | |||
@@ -15,6 +15,7 @@ int cksum_main(int argc UNUSED_PARAM, char **argv) | |||
15 | uint32_t crc; | 15 | uint32_t crc; |
16 | off_t length, filesize; | 16 | off_t length, filesize; |
17 | int bytes_read; | 17 | int bytes_read; |
18 | int exit_code = EXIT_SUCCESS; | ||
18 | uint8_t *cp; | 19 | uint8_t *cp; |
19 | 20 | ||
20 | #if ENABLE_DESKTOP | 21 | #if ENABLE_DESKTOP |
@@ -27,8 +28,10 @@ int cksum_main(int argc UNUSED_PARAM, char **argv) | |||
27 | do { | 28 | do { |
28 | int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input); | 29 | int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input); |
29 | 30 | ||
30 | if (fd < 0) | 31 | if (fd < 0) { |
32 | exit_code = EXIT_FAILURE; | ||
31 | continue; | 33 | continue; |
34 | } | ||
32 | crc = 0; | 35 | crc = 0; |
33 | length = 0; | 36 | length = 0; |
34 | 37 | ||
@@ -60,5 +63,5 @@ int cksum_main(int argc UNUSED_PARAM, char **argv) | |||
60 | crc, filesize, *argv); | 63 | crc, filesize, *argv); |
61 | } while (*argv && *++argv); | 64 | } while (*argv && *++argv); |
62 | 65 | ||
63 | fflush_stdout_and_exit(EXIT_SUCCESS); | 66 | fflush_stdout_and_exit(exit_code); |
64 | } | 67 | } |