summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko2013-07-02 19:11:01 +0200
committerDenys Vlasenko2013-07-02 19:11:01 +0200
commitcd8eece88ed6da58209a18a8c3edac73eab27e1c (patch)
treef05a801cdc773272a64d882f62ab3b1609423be0 /coreutils
parent3e7ecb179b193bf17323c975890eed1d025f7e4c (diff)
downloadbusybox-cd8eece88ed6da58209a18a8c3edac73eab27e1c.zip
busybox-cd8eece88ed6da58209a18a8c3edac73eab27e1c.tar.gz
foo*sum: report I/O errors, don't merely exit with 1.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/md5_sha1_sum.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 92a4d44..b23c6c0 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -151,7 +151,9 @@ static uint8_t *hash_file(const char *filename)
update(&context, in_buf, count);
}
hash_value = NULL;
- if (count == 0) {
+ if (count < 0) {
+ bb_perror_msg("can't read '%s'", filename);
+ else /* count == 0 */ {
final(&context, in_buf);
hash_value = hash_bin_to_hex(in_buf, hash_len);
}