cpio: use rather better upstream patch
Related: #1001965 Version: 2.11-23
This commit is contained in:
parent
2f182f04e8
commit
ddd988f59b
@ -1,75 +1,96 @@
|
||||
diff --git a/src/copyin.c b/src/copyin.c
|
||||
index 09f226b..d505407 100644
|
||||
--- a/src/copyin.c
|
||||
+++ b/src/copyin.c
|
||||
@@ -178,7 +178,7 @@ list_file(struct cpio_file_stat* file_hdr, int in_file_des)
|
||||
#endif
|
||||
if (crc != file_hdr->c_chksum)
|
||||
{
|
||||
- error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"),
|
||||
+ error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
|
||||
file_hdr->c_name, crc, file_hdr->c_chksum);
|
||||
}
|
||||
}
|
||||
@@ -525,7 +525,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
|
||||
if (archive_format == arf_crcascii)
|
||||
{
|
||||
if (crc != file_hdr->c_chksum)
|
||||
- error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"),
|
||||
+ error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
|
||||
file_hdr->c_name, crc, file_hdr->c_chksum);
|
||||
}
|
||||
tape_skip_padding (in_file_des, file_hdr->c_filesize);
|
||||
@@ -550,7 +550,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
|
||||
if (archive_format == arf_crcascii)
|
||||
{
|
||||
if (crc != file_hdr->c_chksum)
|
||||
- error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"),
|
||||
+ error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
|
||||
file_hdr->c_name, crc, file_hdr->c_chksum);
|
||||
}
|
||||
|
||||
@@ -1442,7 +1442,7 @@ process_copy_in ()
|
||||
tape_skip_padding (in_file_des, file_hdr.c_filesize);
|
||||
if (crc != file_hdr.c_chksum)
|
||||
{
|
||||
- error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"),
|
||||
+ error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
|
||||
file_hdr.c_name, crc, file_hdr.c_chksum);
|
||||
}
|
||||
/* Debian hack: -v and -V now work with --only-verify-crc.
|
||||
diff --git a/src/copyout.c b/src/copyout.c
|
||||
index 72f1989..ee6f24a 100644
|
||||
index 72f1989..03eaf88 100644
|
||||
--- a/src/copyout.c
|
||||
+++ b/src/copyout.c
|
||||
@@ -59,7 +59,7 @@ read_for_checksum (int in_file_des, int file_size, char *file_name)
|
||||
if (lseek (in_file_des, 0L, SEEK_SET))
|
||||
error (1, errno, _("cannot read checksum for %s"), file_name);
|
||||
|
||||
- return crc;
|
||||
+ return crc & CHKSUM_MAX;
|
||||
}
|
||||
|
||||
/* Write out NULs to fill out the rest of the current block on
|
||||
@@ -381,7 +381,7 @@ write_out_new_ascii_header (const char *magic_string,
|
||||
_("name size")))
|
||||
return 1;
|
||||
p += 8;
|
||||
- to_ascii (p, file_hdr->c_chksum & 0xffffffff, 8, LG_16);
|
||||
+ to_ascii (p, file_hdr->c_chksum & CHKSUM_MAX, 8, LG_16);
|
||||
|
||||
tape_buffered_write (ascii_header, out_des, sizeof ascii_header);
|
||||
@@ -33,10 +33,10 @@
|
||||
/* Read FILE_SIZE bytes of FILE_NAME from IN_FILE_DES and
|
||||
compute and return a checksum for them. */
|
||||
|
||||
-static unsigned long
|
||||
+static uint32_t
|
||||
read_for_checksum (int in_file_des, int file_size, char *file_name)
|
||||
{
|
||||
- unsigned long crc;
|
||||
+ uint32_t crc;
|
||||
char buf[BUFSIZ];
|
||||
int bytes_left;
|
||||
int bytes_read;
|
||||
diff --git a/src/cpiohdr.h b/src/cpiohdr.h
|
||||
index bb1ad6b..1c11998 100644
|
||||
--- a/src/cpiohdr.h
|
||||
+++ b/src/cpiohdr.h
|
||||
@@ -123,7 +123,7 @@ struct cpio_file_stat /* Internal representation of a CPIO header */
|
||||
long c_rdev_maj;
|
||||
long c_rdev_min;
|
||||
size_t c_namesize;
|
||||
- unsigned long c_chksum;
|
||||
+ uint32_t c_chksum;
|
||||
char *c_name;
|
||||
char *c_tar_linkname;
|
||||
};
|
||||
diff --git a/src/extern.h b/src/extern.h
|
||||
index 4f94d40..b274690 100644
|
||||
index 4f94d40..3530bf6 100644
|
||||
--- a/src/extern.h
|
||||
+++ b/src/extern.h
|
||||
@@ -205,6 +205,8 @@ int cpio_create_dir (struct cpio_file_stat *file_hdr, int existing_dir);
|
||||
#define LG_8 3
|
||||
#define LG_16 4
|
||||
@@ -75,7 +75,7 @@ extern char *new_media_message_after_number;
|
||||
extern int archive_des;
|
||||
extern char *archive_name;
|
||||
extern char *rsh_command_option;
|
||||
-extern unsigned long crc;
|
||||
+extern uint32_t crc;
|
||||
extern int delayed_seek_count;
|
||||
#ifdef DEBUG_CPIO
|
||||
extern int debug_flag;
|
||||
diff --git a/src/global.c b/src/global.c
|
||||
index cff9720..336941e 100644
|
||||
--- a/src/global.c
|
||||
+++ b/src/global.c
|
||||
@@ -144,7 +144,7 @@ char *archive_name = NULL;
|
||||
char *rsh_command_option = NULL;
|
||||
|
||||
+#define CHKSUM_MAX 0xffffffffu
|
||||
+
|
||||
uintmax_t from_ascii (char const *where, size_t digs, unsigned logbase);
|
||||
/* CRC checksum. */
|
||||
-unsigned long crc;
|
||||
+uint32_t crc;
|
||||
|
||||
#define FROM_OCTAL(f) from_ascii (f, sizeof f, LG_8)
|
||||
diff --git a/src/util.c b/src/util.c
|
||||
index 00953d5..e307c58 100644
|
||||
--- a/src/util.c
|
||||
+++ b/src/util.c
|
||||
@@ -413,6 +413,8 @@ tape_toss_input (int in_des, off_t num_bytes)
|
||||
input_size -= space_left;
|
||||
bytes_left -= space_left;
|
||||
}
|
||||
+
|
||||
+ crc &= CHKSUM_MAX;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -461,6 +463,8 @@ copy_files_tape_to_disk (int in_des, int out_des, off_t num_bytes)
|
||||
input_size -= size;
|
||||
in_buff += size;
|
||||
}
|
||||
+
|
||||
+ crc &= CHKSUM_MAX;
|
||||
}
|
||||
/* Copy a file using the input and output buffers, which may start out
|
||||
partly full. After the copy, the files are not closed nor the last
|
||||
@@ -514,6 +518,8 @@ copy_files_disk_to_tape (int in_des, int out_des, off_t num_bytes,
|
||||
input_size -= size;
|
||||
in_buff += size;
|
||||
}
|
||||
+
|
||||
+ crc &= CHKSUM_MAX;
|
||||
}
|
||||
/* Copy a file using the input and output buffers, which may start out
|
||||
partly full. After the copy, the files are not closed nor the last
|
||||
@@ -564,6 +570,8 @@ copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes,
|
||||
input_size -= size;
|
||||
in_buff += size;
|
||||
}
|
||||
+
|
||||
+ crc &= CHKSUM_MAX;
|
||||
}
|
||||
|
||||
/* Warn if file changed while it was being copied. */
|
||||
/* Input and output buffers. */
|
||||
char *input_buffer, *output_buffer;
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: A GNU archiving program
|
||||
Name: cpio
|
||||
Version: 2.11
|
||||
Release: 22%{?dist}
|
||||
Release: 23%{?dist}
|
||||
License: GPLv3+
|
||||
Group: Applications/Archiving
|
||||
URL: http://www.gnu.org/software/cpio/
|
||||
@ -110,7 +110,7 @@ fi
|
||||
%{_infodir}/*.info*
|
||||
|
||||
%changelog
|
||||
* Fri Sep 20 2013 Pavel Raiskup <praiskup@redhat.com> - 2.11-22
|
||||
* Fri Sep 20 2013 Pavel Raiskup <praiskup@redhat.com> - 2.11-23
|
||||
- properly trim "crc" checksum to 32 bits (#1001965)
|
||||
- remove unneeded patch for config.gues/config.sub (#951442)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user