]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blobdiff - diffutils/patches/diffutils-cmp-s-empty.patch
diffutils: Update to 3.2.
[people/amarx/ipfire-3.x.git] / diffutils / patches / diffutils-cmp-s-empty.patch
diff --git a/diffutils/patches/diffutils-cmp-s-empty.patch b/diffutils/patches/diffutils-cmp-s-empty.patch
new file mode 100644 (file)
index 0000000..bc1c6b4
--- /dev/null
@@ -0,0 +1,20 @@
+diff -up diffutils-2.8.1/src/cmp.c.cmp-s-empty diffutils-2.8.1/src/cmp.c
+--- diffutils-2.8.1/src/cmp.c.cmp-s-empty      2002-04-05 21:37:31.000000000 +0100
++++ diffutils-2.8.1/src/cmp.c  2010-06-25 14:56:08.464802321 +0100
+@@ -316,12 +316,15 @@ main (int argc, char **argv)
+   /* If only a return code is needed,
+      and if both input descriptors are associated with plain files,
++     and if both files are larger than 0 bytes (procfs files are always 0),
+      conclude that the files differ if they have different sizes
+      and if more bytes will be compared than are in the smaller file.  */
+   if (comparison_type == type_status
+       && S_ISREG (stat_buf[0].st_mode)
+-      && S_ISREG (stat_buf[1].st_mode))
++      && S_ISREG (stat_buf[1].st_mode)
++      && stat_buf[0].st_size > 0
++      && stat_buf[1].st_size > 0)
+     {
+       off_t s0 = stat_buf[0].st_size - file_position (0);
+       off_t s1 = stat_buf[1].st_size - file_position (1);