summaryrefslogtreecommitdiff
path: root/coreutils/md5_sha1_sum.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/md5_sha1_sum.c')
-rw-r--r--coreutils/md5_sha1_sum.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 3b389cb6b..0e57673f1 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -300,12 +300,10 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
char *filename_ptr;
count_total++;
- filename_ptr = strstr(line, " ");
- /* handle format for binary checksums */
- if (filename_ptr == NULL) {
- filename_ptr = strstr(line, " *");
- }
- if (filename_ptr == NULL) {
+ filename_ptr = strchr(line, ' ');
+ if (filename_ptr == NULL
+ || (filename_ptr[1] != ' ' && filename_ptr[1] != '*')
+ ) {
if (flags & FLAG_WARN) {
bb_simple_error_msg("invalid format");
}