2006-05-16 Dmitry V. Levin * tests/genfile.c (argp_program_version, argp_program_bug_address): Remove static qualifier. 2005-05-04 Dmitry V. Levin Deal with compilation warnings generated by gcc compiler. * src/copyin.c (list_file, copyin_regular_file, long_format, process_copy_in): Fix format strings. (create_defered_links_to_skipped): Remove unused variable `link_res'. (process_copy_in): Initialize tty_in, tty_out and rename_in. * src/copyout.c (write_out_header): Initialize dev along with rdev. * src/tar.c (is_tar_filename_too_long): Remove unused variable `p'; * src/util.c: Include and (sparse_write): Add forward declaration. Initialize write_count and cur_write_start variables. (copy_files_disk_to_tape, copy_files_disk_to_disk): Add parentheses around assignment. diff -uprk.orig cpio-2.6.orig/src/copyin.c cpio-2.6/src/copyin.c --- cpio-2.6.orig/src/copyin.c 2004-09-08 11:10:02 +0000 +++ cpio-2.6/src/copyin.c 2005-05-04 12:43:42 +0000 @@ -176,7 +176,7 @@ list_file(struct new_cpio_header* file_h #endif if (crc != file_hdr->c_chksum) { - error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"), + error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"), file_hdr->c_name, crc, file_hdr->c_chksum); } } @@ -307,7 +307,6 @@ create_defered_links_to_skipped (struct int ino; int maj; int min; - int link_res; if (file_hdr->c_filesize == 0) { /* The file doesn't have any data attached to it so we don't have @@ -541,7 +540,7 @@ copyin_regular_file (struct new_cpio_hea if (archive_format == arf_crcascii) { if (crc != file_hdr->c_chksum) - error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"), + error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"), file_hdr->c_name, crc, file_hdr->c_chksum); } tape_skip_padding (in_file_des, file_hdr->c_filesize); @@ -563,7 +562,7 @@ copyin_regular_file (struct new_cpio_hea if (archive_format == arf_crcascii) { if (crc != file_hdr->c_chksum) - error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"), + error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"), file_hdr->c_name, crc, file_hdr->c_chksum); } @@ -897,7 +896,7 @@ long_format (struct new_cpio_header *fil } tbuf[16] = '\0'; - printf ("%s %3u ", mbuf, file_hdr->c_nlink); + printf ("%s %3lu ", mbuf, file_hdr->c_nlink); if (numeric_uid) printf ("%-8u %-8u ", (unsigned int) file_hdr->c_uid, @@ -908,7 +907,7 @@ long_format (struct new_cpio_header *fil if ((file_hdr->c_mode & CP_IFMT) == CP_IFCHR || (file_hdr->c_mode & CP_IFMT) == CP_IFBLK) - printf ("%3u, %3u ", file_hdr->c_rdev_maj, + printf ("%3lu, %3lu ", file_hdr->c_rdev_maj, file_hdr->c_rdev_min); else printf ("%8lu ", file_hdr->c_filesize); @@ -1342,9 +1341,9 @@ void process_copy_in () { char done = false; /* True if trailer reached. */ - FILE *tty_in; /* Interactive file for rename option. */ - FILE *tty_out; /* Interactive file for rename option. */ - FILE *rename_in; /* Batch file for rename option. */ + FILE *tty_in = NULL; /* Interactive file for rename option. */ + FILE *tty_out = NULL; /* Interactive file for rename option. */ + FILE *rename_in = NULL; /* Batch file for rename option. */ struct stat file_stat; /* Output file stat record. */ struct new_cpio_header file_hdr; /* Output header information. */ int in_file_des; /* Input file descriptor. */ @@ -1530,7 +1529,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%x, should be 0x%x)"), + error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"), file_hdr.c_name, crc, file_hdr.c_chksum); } /* Debian hack: -v and -V now work with --only-verify-crc. diff -uprk.orig cpio-2.6.orig/src/copyout.c cpio-2.6/src/copyout.c --- cpio-2.6.orig/src/copyout.c 2004-10-14 09:14:03 +0000 +++ cpio-2.6/src/copyout.c 2005-05-04 12:41:08 +0000 @@ -346,7 +346,7 @@ write_out_header (struct new_cpio_header #endif file_hdr->c_filesize = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min); - rdev = 1; + dev = rdev = 1; break; default: dev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min); diff -uprk.orig cpio-2.6.orig/src/tar.c cpio-2.6/src/tar.c --- cpio-2.6.orig/src/tar.c 2004-10-14 09:33:41 +0000 +++ cpio-2.6/src/tar.c 2005-05-04 12:41:47 +0000 @@ -473,7 +473,6 @@ is_tar_filename_too_long (char *name) { int whole_name_len; int prefix_name_len; - char *p; whole_name_len = strlen (name); if (whole_name_len <= TARNAMESIZE) diff -uprk.orig cpio-2.6.orig/src/util.c cpio-2.6/src/util.c --- cpio-2.6.orig/src/util.c 2004-09-08 10:44:49 +0000 +++ cpio-2.6/src/util.c 2005-05-04 13:13:24 +0000 @@ -24,6 +24,8 @@ #include "dstring.h" #include "extern.h" #include +#include +#include #include @@ -38,6 +40,8 @@ extern int errno; #endif +int sparse_write (int fildes, char *buf, unsigned int nbyte); + /* Write `output_size' bytes of `output_buffer' to file descriptor OUT_DES and reset `output_size' and `out_buff'. */ @@ -471,9 +475,9 @@ copy_files_disk_to_tape (int in_des, int while (num_bytes > 0) { if (input_size == 0) - if (rc = disk_fill_input_buffer (in_des, + if ((rc = disk_fill_input_buffer (in_des, num_bytes < DISK_IO_BLOCK_SIZE ? - num_bytes : DISK_IO_BLOCK_SIZE)) + num_bytes : DISK_IO_BLOCK_SIZE))) { if (rc > 0) error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"), @@ -517,7 +521,7 @@ copy_files_disk_to_disk (int in_des, int while (num_bytes > 0) { if (input_size == 0) - if (rc = disk_fill_input_buffer (in_des, num_bytes)) + if ((rc = disk_fill_input_buffer (in_des, num_bytes))) { if (rc > 0) error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"), @@ -1157,8 +1161,8 @@ sparse_write (int fildes, char *buf, uns int complete_block_count; int leftover_bytes_count; int seek_count; - int write_count; - char *cur_write_start; + int write_count = 0; + char *cur_write_start = buf; int lseek_rc; int write_rc; int i; --- cpio-2.6.orig/tests/genfile.c 2004-09-08 11:50:20 +0000 +++ cpio-2.6/tests/genfile.c 2006-05-15 22:21:18 +0000 @@ -60,8 +60,8 @@ /* Block buffer for sparse file */ char *buffer; -static const char *argp_program_version = "genfile (" PACKAGE ") " VERSION; -static const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; +const char *argp_program_version = "genfile (" PACKAGE ") " VERSION; +const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; static char doc[] = N_("genfile generates data files for GNU paxutils test suite"); static struct argp_option options[] = {