diff options
author | Pádraig Brady <P@draigBrady.com> | 2021-09-16 12:29:12 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2021-09-16 20:39:28 +0100 |
commit | e6c57cf19b1e2660da1ceca92fc8837493cd157e (patch) | |
tree | 870b68de15a7f404ade76e267c5c6dc3a76e8196 /src/digest.c | |
parent | 7ebcd88fb271b836d3feca443c58e74751442877 (diff) | |
download | coreutils-e6c57cf19b1e2660da1ceca92fc8837493cd157e.tar.gz |
digest: ignore empty lines when checking
* src/digest.c (digest_check): Treat empty lines like comments,
as commented checksum files very often have empty lines.
* tests/misc/md5sum.pl: Adjust accordingly.
Diffstat (limited to 'src/digest.c')
-rw-r--r-- | src/digest.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/digest.c b/src/digest.c index 9ee37a104..9398a133e 100644 --- a/src/digest.c +++ b/src/digest.c @@ -1073,6 +1073,11 @@ digest_check (char const *checkfile_name) line_length -= line[line_length - 1] == '\n'; /* Remove any trailing carriage return. */ line_length -= line[line_length - (0 < line_length)] == '\r'; + + /* Ignore empty lines. */ + if (line_length == 0) + continue; + line[line_length] = '\0'; if (! (split_3 (line, line_length, &hex_digest, &binary, &filename) |