bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: md5sum --check did not work with "\r\n" and "\r" line endings


From: Simon Hengel
Subject: PATCH: md5sum --check did not work with "\r\n" and "\r" line endings
Date: Wed, 16 Apr 2008 18:37:25 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080227)

Hello list,
md5sum with the -c option did not work on files with "\r\n" and "\r" line
endings.

A patch is attached.

With best regards,

Simon Hengel.
=== modified file 'src/md5sum.c'
--- src/md5sum.c        2008-04-16 15:51:12 +0000
+++ src/md5sum.c        2008-04-16 16:27:50 +0000
@@ -465,7 +465,12 @@
        continue;
 
       /* Remove any trailing newline.  */
-      if (line[line_length - 1] == '\n')
+      while (line_length &&
+             (
+              (line[line_length - 1] == '\n') ||
+              (line[line_length - 1] == '\r')
+             )
+           )
        line[--line_length] = '\0';
 
       if (! (split_3 (line, line_length, &hex_digest, &binary, &filename)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]