diff options
-rw-r--r-- | coreutils/cksum.c | 7 | ||||
-rw-r--r-- | coreutils/printenv.c | 6 |
2 files changed, 10 insertions, 3 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 | } |
diff --git a/coreutils/printenv.c b/coreutils/printenv.c index 6971f7258..2430f3a1a 100644 --- a/coreutils/printenv.c +++ b/coreutils/printenv.c | |||
@@ -13,6 +13,8 @@ | |||
13 | int printenv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 13 | int printenv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
14 | int printenv_main(int argc UNUSED_PARAM, char **argv) | 14 | int printenv_main(int argc UNUSED_PARAM, char **argv) |
15 | { | 15 | { |
16 | int exit_code = EXIT_SUCCESS; | ||
17 | |||
16 | /* no variables specified, show whole env */ | 18 | /* no variables specified, show whole env */ |
17 | if (!argv[1]) { | 19 | if (!argv[1]) { |
18 | int e = 0; | 20 | int e = 0; |
@@ -26,8 +28,10 @@ int printenv_main(int argc UNUSED_PARAM, char **argv) | |||
26 | env = getenv(arg); | 28 | env = getenv(arg); |
27 | if (env) | 29 | if (env) |
28 | puts(env); | 30 | puts(env); |
31 | else | ||
32 | exit_code = EXIT_FAILURE; | ||
29 | } | 33 | } |
30 | } | 34 | } |
31 | 35 | ||
32 | fflush_stdout_and_exit(EXIT_SUCCESS); | 36 | fflush_stdout_and_exit(exit_code); |
33 | } | 37 | } |