pkubat / rpms / cpio

Forked from rpms/cpio 4 years ago
Clone
cd1ff72
--- cpio-2.6/src/util.c.lfs	2004-09-08 12:44:49.000000000 +0200
cd1ff72
+++ cpio-2.6/src/util.c	2006-03-25 13:34:10.000000000 +0100
edfc3dd
@@ -207,7 +207,7 @@
edfc3dd
    Exit with an error if end of file is reached.  */
edfc3dd
 
edfc3dd
 static int
edfc3dd
-disk_fill_input_buffer (int in_des, int num_bytes)
9cadd2b
+disk_fill_input_buffer (int in_des, off_t num_bytes)
edfc3dd
 {
edfc3dd
   in_buff = input_buffer;
edfc3dd
   num_bytes = (num_bytes < DISK_IO_BLOCK_SIZE) ? num_bytes : DISK_IO_BLOCK_SIZE;
9cadd2b
@@ -227,10 +227,10 @@
edfc3dd
    When `out_buff' fills up, flush it to file descriptor OUT_DES.  */
edfc3dd
 
edfc3dd
 void
edfc3dd
-tape_buffered_write (char *in_buf, int out_des, long num_bytes)
9cadd2b
+tape_buffered_write (char *in_buf, int out_des, off_t num_bytes)
edfc3dd
 {
edfc3dd
-  register long bytes_left = num_bytes;	/* Bytes needing to be copied.  */
9cadd2b
-  register long space_left;	/* Room left in output buffer.  */
9cadd2b
+  off_t bytes_left = num_bytes;	/* Bytes needing to be copied.  */
9cadd2b
+  off_t space_left;	/* Room left in output buffer.  */
edfc3dd
 
edfc3dd
   while (bytes_left > 0)
9cadd2b
     {
9cadd2b
@@ -254,10 +254,10 @@
edfc3dd
    When `out_buff' fills up, flush it to file descriptor OUT_DES.  */
edfc3dd
 
edfc3dd
 void
edfc3dd
-disk_buffered_write (char *in_buf, int out_des, long num_bytes)
9cadd2b
+disk_buffered_write (char *in_buf, int out_des, off_t num_bytes)
9cadd2b
 {
9cadd2b
-  register long bytes_left = num_bytes;	/* Bytes needing to be copied.  */
9cadd2b
-  register long space_left;	/* Room left in output buffer.  */
9cadd2b
+  off_t bytes_left = num_bytes;	/* Bytes needing to be copied.  */
9cadd2b
+  off_t space_left;	/* Room left in output buffer.  */
9cadd2b
 
9cadd2b
   while (bytes_left > 0)
9cadd2b
     {
9cadd2b
@@ -282,10 +282,10 @@
9cadd2b
    When `in_buff' is exhausted, refill it from file descriptor IN_DES.  */
9cadd2b
 
9cadd2b
 void
9cadd2b
-tape_buffered_read (char *in_buf, int in_des, long num_bytes)
9cadd2b
+tape_buffered_read (char *in_buf, int in_des, off_t num_bytes)
edfc3dd
 {
edfc3dd
-  register long bytes_left = num_bytes;	/* Bytes needing to be copied.  */
9cadd2b
-  register long space_left;	/* Bytes to copy from input buffer.  */
9cadd2b
+  off_t bytes_left = num_bytes;	/* Bytes needing to be copied.  */
9cadd2b
+  off_t space_left;	/* Bytes to copy from input buffer.  */
edfc3dd
 
edfc3dd
   while (bytes_left > 0)
9cadd2b
     {
9cadd2b
@@ -376,10 +376,10 @@
501abeb
 /* Skip the next NUM_BYTES bytes of file descriptor IN_DES.  */
501abeb
 
501abeb
 void
501abeb
-tape_toss_input (int in_des, long num_bytes)
9cadd2b
+tape_toss_input (int in_des, off_t num_bytes)
501abeb
 {
501abeb
-  register long bytes_left = num_bytes;	/* Bytes needing to be copied.  */
9cadd2b
-  register long space_left;	/* Bytes to copy from input buffer.  */
9cadd2b
+  off_t bytes_left = num_bytes;	/* Bytes needing to be copied.  */
9cadd2b
+  off_t space_left;	/* Bytes to copy from input buffer.  */
501abeb
 
501abeb
   while (bytes_left > 0)
9cadd2b
     {
501abeb
@@ -404,12 +404,12 @@
501abeb
 }
501abeb
 
501abeb
 static void
501abeb
-write_nuls_to_file (long num_bytes, int out_des, 
9cadd2b
-                    void (*writer) (char *in_buf, int out_des, long num_bytes))
9cadd2b
+write_nuls_to_file (off_t num_bytes, int out_des, 
9cadd2b
+                    void (*writer) (char *in_buf, int out_des, off_t num_bytes))
edfc3dd
 {
edfc3dd
-  long	blocks;
9cadd2b
-  long	extra_bytes;
edfc3dd
-  long	i;
9cadd2b
+  off_t blocks;
9cadd2b
+  off_t	extra_bytes;
9cadd2b
+  off_t	i;
edfc3dd
 
edfc3dd
   blocks = num_bytes / 512;
edfc3dd
   extra_bytes = num_bytes % 512;
9cadd2b
@@ -428,7 +428,7 @@
edfc3dd
    NUM_BYTES is the number of bytes to copy.  */
edfc3dd
 
edfc3dd
 void
edfc3dd
-copy_files_tape_to_disk (int in_des, int out_des, long num_bytes)
9cadd2b
+copy_files_tape_to_disk (int in_des, int out_des, off_t num_bytes)
edfc3dd
 {
9cadd2b
   long size;
9cadd2b
   long k;
edfc3dd
@@ -458,13 +458,13 @@
edfc3dd
    NUM_BYTES is the number of bytes to copy.  */
edfc3dd
 
edfc3dd
 void
edfc3dd
-copy_files_disk_to_tape (int in_des, int out_des, long num_bytes,
9cadd2b
+copy_files_disk_to_tape (int in_des, int out_des, off_t num_bytes,
edfc3dd
 			 char *filename)
edfc3dd
 {
9cadd2b
   long size;
9cadd2b
   long k;
edfc3dd
   int rc;
edfc3dd
-  long original_num_bytes;
9cadd2b
+  off_t original_num_bytes;
edfc3dd
 
edfc3dd
   original_num_bytes = num_bytes;
edfc3dd
 
edfc3dd
@@ -476,10 +476,10 @@
edfc3dd
 	  num_bytes : DISK_IO_BLOCK_SIZE))
edfc3dd
 	  {
edfc3dd
 	    if (rc > 0)
edfc3dd
-	      error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"),
edfc3dd
+	      error (0, 0, _("File %s shrunk by %lld bytes, padding with zeros"),
edfc3dd
 				filename, num_bytes);
edfc3dd
 	    else
edfc3dd
-	      error (0, 0, _("Read error at byte %ld in file %s, padding with zeros"),
edfc3dd
+	      error (0, 0, _("Read error at byte %lld in file %s, padding with zeros"),
edfc3dd
 			original_num_bytes - num_bytes, filename);
edfc3dd
 	    write_nuls_to_file (num_bytes, out_des, tape_buffered_write);
edfc3dd
 	    break;
edfc3dd
@@ -505,12 +505,12 @@
edfc3dd
    NUM_BYTES is the number of bytes to copy.  */
edfc3dd
 
edfc3dd
 void
edfc3dd
-copy_files_disk_to_disk (int in_des, int out_des, long num_bytes,
9cadd2b
+copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes,
edfc3dd
 			 char *filename)
edfc3dd
 {
9cadd2b
   long size;
9cadd2b
   long k;
edfc3dd
-  long original_num_bytes;
9cadd2b
+  off_t original_num_bytes;
edfc3dd
   int rc;
edfc3dd
 
edfc3dd
   original_num_bytes = num_bytes;
edfc3dd
@@ -520,10 +520,10 @@
edfc3dd
 	if (rc = disk_fill_input_buffer (in_des, num_bytes))
edfc3dd
 	  {
edfc3dd
 	    if (rc > 0)
edfc3dd
-	      error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"),
edfc3dd
+	      error (0, 0, _("File %s shrunk by %lld bytes, padding with zeros"),
edfc3dd
 				filename, num_bytes);
edfc3dd
 	    else
edfc3dd
-	      error (0, 0, _("Read error at byte %ld in file %s, padding with zeros"),
edfc3dd
+	      error (0, 0, _("Read error at byte %lld in file %s, padding with zeros"),
edfc3dd
 			original_num_bytes - num_bytes, filename);
edfc3dd
 	    write_nuls_to_file (num_bytes, out_des, disk_buffered_write);
edfc3dd
 	    break;
9cadd2b
@@ -544,7 +544,7 @@
9cadd2b
 /* Warn if file changed while it was being copied.  */
9cadd2b
 
9cadd2b
 void
9cadd2b
-warn_if_file_changed (char *file_name, unsigned long old_file_size,
9cadd2b
+warn_if_file_changed (char *file_name, off_t old_file_size,
9cadd2b
 		      unsigned long old_file_mtime)
9cadd2b
 {
9cadd2b
   struct stat new_file_stat;
9cadd2b
@@ -696,8 +696,8 @@
9cadd2b
 	   temp = (temp + 1) % hash_size)
9cadd2b
 	{
9cadd2b
 	  if (hash_table[temp]->inode == node_num
9cadd2b
-	      && hash_table[start]->major_num == major_num
9cadd2b
-	      && hash_table[start]->minor_num == minor_num)
9cadd2b
+	      && hash_table[temp]->major_num == major_num
9cadd2b
+	      && hash_table[temp]->minor_num == minor_num)
9cadd2b
 	    return hash_table[temp]->file_name;
9cadd2b
 	}
9cadd2b
     }
cd1ff72
--- cpio-2.6/src/copyin.c.lfs	2004-09-08 13:10:02.000000000 +0200
cd1ff72
+++ cpio-2.6/src/copyin.c	2006-03-25 13:35:43.000000000 +0100
cd1ff72
@@ -106,7 +106,7 @@
cd1ff72
    header type.  */
cd1ff72
 
cd1ff72
 static void
cd1ff72
-tape_skip_padding (int in_file_des, int offset)
cd1ff72
+tape_skip_padding (int in_file_des, off_t offset)
cd1ff72
 {
cd1ff72
   int pad;
cd1ff72
 
cd1ff72
@@ -911,7 +911,7 @@
cd1ff72
     printf ("%3u, %3u ", file_hdr->c_rdev_maj,
cd1ff72
 	    file_hdr->c_rdev_min);
cd1ff72
   else
cd1ff72
-    printf ("%8lu ", file_hdr->c_filesize);
cd1ff72
+    printf ("%8llu ", file_hdr->c_filesize);
cd1ff72
 
cd1ff72
   printf ("%s ", tbuf + 4);
cd1ff72
 
cd1ff72
@@ -1153,7 +1153,7 @@
cd1ff72
   tape_buffered_read (ascii_header, in_des, 70L);
cd1ff72
   ascii_header[70] = '\0';
cd1ff72
   sscanf (ascii_header,
cd1ff72
-	  "%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11lo",
cd1ff72
+	  "%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11llo",
cd1ff72
 	  &dev, &file_hdr->c_ino,
cd1ff72
 	  &file_hdr->c_mode, &file_hdr->c_uid, &file_hdr->c_gid,
cd1ff72
 	  &file_hdr->c_nlink, &rdev, &file_hdr->c_mtime,
cd1ff72
@@ -1211,7 +1211,7 @@
cd1ff72
   tape_buffered_read (ascii_header, in_des, 104L);
cd1ff72
   ascii_header[104] = '\0';
cd1ff72
   sscanf (ascii_header,
cd1ff72
-	  "%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx",
cd1ff72
+	  "%8lx%8lx%8lx%8lx%8lx%8lx%8llx%8lx%8lx%8lx%8lx%8lx%8lx",
cd1ff72
 	  &file_hdr->c_ino, &file_hdr->c_mode, &file_hdr->c_uid,
cd1ff72
 	  &file_hdr->c_gid, &file_hdr->c_nlink, &file_hdr->c_mtime,
cd1ff72
 	  &file_hdr->c_filesize, &file_hdr->c_dev_maj, &file_hdr->c_dev_min,
cd1ff72
--- cpio-2.6/src/extern.h.lfs	2004-09-08 12:49:57.000000000 +0200
cd1ff72
+++ cpio-2.6/src/extern.h	2006-03-25 13:34:10.000000000 +0100
cd1ff72
@@ -161,14 +161,14 @@
cd1ff72
 void tape_empty_output_buffer P_((int out_des));
cd1ff72
 void disk_empty_output_buffer P_((int out_des));
cd1ff72
 void swahw_array P_((char *ptr, int count));
cd1ff72
-void tape_buffered_write P_((char *in_buf, int out_des, long num_bytes));
cd1ff72
-void tape_buffered_read P_((char *in_buf, int in_des, long num_bytes));
cd1ff72
+void tape_buffered_write P_((char *in_buf, int out_des, off_t num_bytes));
cd1ff72
+void tape_buffered_read P_((char *in_buf, int in_des, off_t num_bytes));
cd1ff72
 int tape_buffered_peek P_((char *peek_buf, int in_des, int num_bytes));
cd1ff72
-void tape_toss_input P_((int in_des, long num_bytes));
cd1ff72
-void copy_files_tape_to_disk P_((int in_des, int out_des, long num_bytes));
cd1ff72
-void copy_files_disk_to_tape P_((int in_des, int out_des, long num_bytes, char *filename));
cd1ff72
-void copy_files_disk_to_disk P_((int in_des, int out_des, long num_bytes, char *filename));
cd1ff72
-void warn_if_file_changed P_((char *file_name, unsigned long old_file_size,
cd1ff72
+void tape_toss_input P_((int in_des, off_t num_bytes));
cd1ff72
+void copy_files_tape_to_disk P_((int in_des, int out_des, off_t num_bytes));
cd1ff72
+void copy_files_disk_to_tape P_((int in_des, int out_des, off_t num_bytes, char *filename));
cd1ff72
+void copy_files_disk_to_disk P_((int in_des, int out_des, off_t num_bytes, char *filename));
cd1ff72
+void warn_if_file_changed P_((char *file_name, off_t old_file_size,
cd1ff72
                               unsigned long old_file_mtime));
cd1ff72
 void create_all_directories P_((char *name));
cd1ff72
 void prepare_append P_((int out_file_des));
cd1ff72
--- cpio-2.6/src/cpiohdr.h.lfs	2003-11-21 15:48:13.000000000 +0100
cd1ff72
+++ cpio-2.6/src/cpiohdr.h	2006-03-25 13:34:10.000000000 +0100
9cadd2b
@@ -34,8 +34,8 @@
9cadd2b
   unsigned short c_mtimes[2];
9cadd2b
   unsigned short c_namesize;
9cadd2b
   unsigned short c_filesizes[2];
9cadd2b
-  unsigned long c_mtime;	/* Long-aligned copy of `c_mtimes'. */
9cadd2b
-  unsigned long c_filesize;	/* Long-aligned copy of `c_filesizes'. */
9cadd2b
+  unsigned int c_mtime;	        /* aligned copy of `c_mtimes'. */
9cadd2b
+  unsigned int c_filesize;	/* aligned copy of `c_filesizes'. */
9cadd2b
   char *c_name;
9cadd2b
 };
9cadd2b
 
9cadd2b
@@ -76,7 +76,7 @@
9cadd2b
   unsigned long c_gid;
9cadd2b
   unsigned long c_nlink;
9cadd2b
   unsigned long c_mtime;
9cadd2b
-  unsigned long c_filesize;
9cadd2b
+  off_t c_filesize;
9cadd2b
   long c_dev_maj;
9cadd2b
   long c_dev_min;
9cadd2b
   long c_rdev_maj;