[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PATCH to enable reading of \r\n Newlines in md5sum
From: |
David Bridson |
Subject: |
PATCH to enable reading of \r\n Newlines in md5sum |
Date: |
Wed, 23 Mar 2005 17:16:20 +0000 |
User-agent: |
Mozilla Thunderbird 0.9 (X11/20041127) |
Hi!
I just ran into a problem checking an md5 file with \r\n line endings. md5sum checks for
\n line endings but not \r\n so, where an \r\n is present, tries to fopen the correct
filename with a \r appended. Here's a simple patch to fix the problem.
Cheers,
Dave
--- coreutils-5.3.0/src/md5sum.c 2004-09-20 08:40:39.000000000 +0100
+++ coreutils-updated/src/md5sum.c 2005-03-23 16:48:16.000000000 +0000
@@ -433,7 +433,17 @@
/* Remove any trailing newline. */
if (line[line_length - 1] == '\n')
- line[--line_length] = '\0';
+ {
+ if (line[line_length - 2] == '\r')
+ {
+ line[--line_length] = '\0';
+ line[--line_length] = '\0';
+ }
+ else
+ {
+ line[--line_length] = '\0';
+ }
+ }
if (! (split_3 (line, line_length, &hex_digest, &binary, &filename)
&& hex_digits (hex_digest)))
- PATCH to enable reading of \r\n Newlines in md5sum,
David Bridson <=