Blame SOURCES/cpio-2.11-crc-big-files.patch

dd3c47
From 610e732bda06aef9ff3b16df757ddc32d8368a1a Mon Sep 17 00:00:00 2001
dd3c47
From: Sergey Poznyakoff <gray@gnu.org.ua>
dd3c47
Date: Mon, 20 Feb 2012 19:51:27 +0200
dd3c47
Subject: [PATCH] Always use 32 bit CRC
dd3c47
dd3c47
* src/cpiohdr.h (cpio_file_stat) <c_chksum>: Change type to
dd3c47
uint32_t.
dd3c47
* src/extern.h (crc): Change type to uint32_t.
dd3c47
* src/global.c: Likewise.
dd3c47
* src/copyout.c (read_for_checksum): Return uint32_t.
dd3c47
* src/copyin.c: Fix printf formats.
dd3c47
---
dd3c47
 src/copyin.c  | 8 ++++----
dd3c47
 src/copyout.c | 4 ++--
dd3c47
 src/cpiohdr.h | 2 +-
dd3c47
 src/extern.h  | 2 +-
dd3c47
 src/global.c  | 2 +-
dd3c47
 5 files changed, 9 insertions(+), 9 deletions(-)
dd3c47
dd3c47
diff --git a/src/copyin.c b/src/copyin.c
dd3c47
index 29d0fb1..db8ee66 100644
dd3c47
--- a/src/copyin.c
dd3c47
+++ b/src/copyin.c
dd3c47
@@ -193,7 +193,7 @@ list_file (struct cpio_file_stat* file_hdr, int in_file_des)
dd3c47
 #endif
dd3c47
       if (crc != file_hdr->c_chksum)
dd3c47
 	{
dd3c47
-	  error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"),
dd3c47
+	  error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
dd3c47
 		 file_hdr->c_name, crc, file_hdr->c_chksum);
dd3c47
 	}
dd3c47
     }
dd3c47
@@ -540,7 +540,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
dd3c47
       if (archive_format == arf_crcascii)
dd3c47
 	{
dd3c47
 	  if (crc != file_hdr->c_chksum)
dd3c47
-	    error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"),
dd3c47
+	    error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
dd3c47
 		   file_hdr->c_name, crc, file_hdr->c_chksum);
dd3c47
 	}
dd3c47
       tape_skip_padding (in_file_des, file_hdr->c_filesize);
dd3c47
@@ -565,7 +565,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
dd3c47
   if (archive_format == arf_crcascii)
dd3c47
     {
dd3c47
       if (crc != file_hdr->c_chksum)
dd3c47
-	error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"),
dd3c47
+	error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
dd3c47
 	       file_hdr->c_name, crc, file_hdr->c_chksum);
dd3c47
     }
dd3c47
 
dd3c47
@@ -1454,7 +1454,7 @@ process_copy_in ()
dd3c47
 	    tape_skip_padding (in_file_des, file_hdr.c_filesize);
dd3c47
 	    if (crc != file_hdr.c_chksum)
dd3c47
 	      {
dd3c47
-		error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"),
dd3c47
+		error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
dd3c47
 		       file_hdr.c_name, crc, file_hdr.c_chksum);
dd3c47
 	      }
dd3c47
          /* Debian hack: -v and -V now work with --only-verify-crc.
dd3c47
diff --git a/src/copyout.c b/src/copyout.c
dd3c47
index 72f1989..03eaf88 100644
dd3c47
--- a/src/copyout.c
dd3c47
+++ b/src/copyout.c
dd3c47
@@ -33,10 +33,10 @@
dd3c47
 /* Read FILE_SIZE bytes of FILE_NAME from IN_FILE_DES and
dd3c47
    compute and return a checksum for them.  */
dd3c47
 
dd3c47
-static unsigned long
dd3c47
+static uint32_t
dd3c47
 read_for_checksum (int in_file_des, int file_size, char *file_name)
dd3c47
 {
dd3c47
-  unsigned long crc;
dd3c47
+  uint32_t crc;
dd3c47
   char buf[BUFSIZ];
dd3c47
   int bytes_left;
dd3c47
   int bytes_read;
dd3c47
diff --git a/src/cpiohdr.h b/src/cpiohdr.h
dd3c47
index bb1ad6b..1c11998 100644
dd3c47
--- a/src/cpiohdr.h
dd3c47
+++ b/src/cpiohdr.h
dd3c47
@@ -123,7 +123,7 @@ struct cpio_file_stat /* Internal representation of a CPIO header */
dd3c47
   long c_rdev_maj;
dd3c47
   long c_rdev_min;
dd3c47
   size_t c_namesize;
dd3c47
-  unsigned long c_chksum;
dd3c47
+  uint32_t c_chksum;
dd3c47
   char *c_name;
dd3c47
   char *c_tar_linkname;
dd3c47
 };
dd3c47
diff --git a/src/extern.h b/src/extern.h
dd3c47
index 4f94d40..3530bf6 100644
dd3c47
--- a/src/extern.h
dd3c47
+++ b/src/extern.h
dd3c47
@@ -75,7 +75,7 @@ extern char *new_media_message_after_number;
dd3c47
 extern int archive_des;
dd3c47
 extern char *archive_name;
dd3c47
 extern char *rsh_command_option;
dd3c47
-extern unsigned long crc;
dd3c47
+extern uint32_t crc;
dd3c47
 extern int delayed_seek_count;
dd3c47
 #ifdef DEBUG_CPIO
dd3c47
 extern int debug_flag;
dd3c47
diff --git a/src/global.c b/src/global.c
dd3c47
index cff9720..336941e 100644
dd3c47
--- a/src/global.c
dd3c47
+++ b/src/global.c
dd3c47
@@ -144,7 +144,7 @@ char *archive_name = NULL;
dd3c47
 char *rsh_command_option = NULL;
dd3c47
 
dd3c47
 /* CRC checksum.  */
dd3c47
-unsigned long crc;
dd3c47
+uint32_t crc;
dd3c47
 
dd3c47
 /* Input and output buffers.  */
dd3c47
 char *input_buffer, *output_buffer;
dd3c47
-- 
dd3c47
2.9.3
dd3c47