diff options
-rw-r--r-- | src/copyout.c | 30 | ||||
-rw-r--r-- | src/util.c | 8 |
2 files changed, 14 insertions, 24 deletions
diff --git a/src/copyout.c b/src/copyout.c index e9849ff..ab6a243 100644 --- a/src/copyout.c +++ b/src/copyout.c @@ -106,22 +106,20 @@ struct deferment *deferouts = NULL; /* Count the number of other (hard) links to this file that have already been defered. */ -static int +static size_t count_defered_links_to_dev_ino (struct cpio_file_stat *file_hdr) { struct deferment *d; - ino_t ino; - int maj; - int min; - int count; - ino = file_hdr->c_ino; - maj = file_hdr->c_dev_maj; - min = file_hdr->c_dev_min; - count = 0; + ino_t ino = file_hdr->c_ino; + long maj = file_hdr->c_dev_maj; + long min = file_hdr->c_dev_min; + size_t count = 0; + for (d = deferouts; d != NULL; d = d->next) { - if ( (d->header.c_ino == ino) && (d->header.c_dev_maj == maj) - && (d->header.c_dev_min == min) ) + if (d->header.c_ino == ino + && d->header.c_dev_maj == maj + && d->header.c_dev_min == min) ++count; } return count; @@ -133,17 +131,9 @@ count_defered_links_to_dev_ino (struct cpio_file_stat *file_hdr) static int last_link (struct cpio_file_stat *file_hdr) { - int other_files_sofar; - - other_files_sofar = count_defered_links_to_dev_ino (file_hdr); - if (file_hdr->c_nlink == (other_files_sofar + 1) ) - { - return 1; - } - return 0; + return file_hdr->c_nlink == count_defered_links_to_dev_ino (file_hdr) + 1; } - /* Add the file header for a link that is being defered to the deferouts list. */ @@ -484,9 +484,9 @@ copy_files_disk_to_tape (int in_des, int out_des, off_t num_bytes, while (num_bytes > 0) { if (input_size == 0) - if (rc = disk_fill_input_buffer (in_des, - num_bytes < DISK_IO_BLOCK_SIZE ? - num_bytes : DISK_IO_BLOCK_SIZE)) + if ((rc = disk_fill_input_buffer (in_des, + num_bytes < DISK_IO_BLOCK_SIZE ? + num_bytes : DISK_IO_BLOCK_SIZE))) { if (rc > 0) { @@ -536,7 +536,7 @@ copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes, 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) { |