Explorar el Código

Add support for DOS line-endings to md5sum.

Scott James Remnant hace 22 años
padre
commit
89dc72bc3a
Se han modificado 3 ficheros con 13 adiciones y 1 borrados
  1. 4 0
      ChangeLog
  2. 1 0
      debian/changelog
  3. 8 1
      utils/md5sum.c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+Thu May 6 23:57:52 BST 2004 Andrew Shugg <andrew@neep.com.au>
+
+  * utils/md5sum.c: Add support for DOS line-endings (\r\n).
+
 Thu May 6 23:52:28 BST 2004 Daniel Kobras <kobras@debian.org>
 
   * archtable: Add ia64-unknown-linux-gnu.

+ 1 - 0
debian/changelog

@@ -8,6 +8,7 @@ dpkg (1.10.22) unstable; urgency=low
     casing.  Closes: #154422.
   * Fix segfault when "gcc -dumpmachine" returns a non-matching triplet.
     Closes: #211850.
+  * Add support for DOS line-endings to md5sum.  Closes: #246103.
   * Correct 'n' and 'p' key descriptions in dselect help message.
     Closes: #120562.
   * Stop hardcoding the list of manual page languages in debian/rules,

+ 8 - 1
utils/md5sum.c

@@ -257,7 +257,14 @@ get_md5_line(FILE *fp, unsigned char *digest, char *file)
 
         /* Strip the trailing newline, if present */
         if (p[i-1] == '\n')
-          p[i-1] = '\0';
+		if (p[i-2] == '\r')
+			if (i < 3)
+				return 0;
+
+			p[i-2] = '\0';
+		else
+			p[i-1] = '\0';
+ 	}
 
 	strcpy(file, p);
 	return rc;