summaryrefslogtreecommitdiff
path: root/coreutils/cksum.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-11-11 22:59:41 +0000
committerDenis Vlasenko2008-11-11 22:59:41 +0000
commitf91f14d2211148ade28270572b9c45023f9b6580 (patch)
tree8b8d9060a9f5c68694f494a4bcbfce9338dc1c65 /coreutils/cksum.c
parent0d8736772d3dda40852c552edfbc649a3494d2fa (diff)
downloadbusybox-f91f14d2211148ade28270572b9c45023f9b6580.zip
busybox-f91f14d2211148ade28270572b9c45023f9b6580.tar.gz
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.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index 546532c..3a77c75 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -15,6 +15,7 @@ int cksum_main(int argc UNUSED_PARAM, char **argv)
uint32_t crc;
off_t length, filesize;
int bytes_read;
+ int exit_code = EXIT_SUCCESS;
uint8_t *cp;
#if ENABLE_DESKTOP
@@ -27,8 +28,10 @@ int cksum_main(int argc UNUSED_PARAM, char **argv)
do {
int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input);
- if (fd < 0)
+ if (fd < 0) {
+ exit_code = EXIT_FAILURE;
continue;
+ }
crc = 0;
length = 0;
@@ -60,5 +63,5 @@ int cksum_main(int argc UNUSED_PARAM, char **argv)
crc, filesize, *argv);
} while (*argv && *++argv);
- fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(exit_code);
}