aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-07-22 13:10:00 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-07-22 13:10:51 +0300
commit6665726a0799e9acc5a7e07eb4dd83b1e4973bb9 (patch)
treef61910800a04e3ed09f820cef27f5f8e3a79dafe
parentc2ab4fa57c12446986447d849b3defc888cc2c6f (diff)
downloadcpio-6665726a0799e9acc5a7e07eb4dd83b1e4973bb9.tar.gz
cpio-6665726a0799e9acc5a7e07eb4dd83b1e4973bb9.tar.bz2
Minor fixes.
* src/copyout.c (count_defered_links_to_dev_ino): Return size_t. (last_link): Do not use superfluous local variable. * src/util.c (copy_files_disk_to_tape) (copy_files_disk_to_disk): Shut down gcc warnings.
-rw-r--r--src/copyout.c30
-rw-r--r--src/util.c8
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;
106/* Count the number of other (hard) links to this file that have 106/* Count the number of other (hard) links to this file that have
107 already been defered. */ 107 already been defered. */
108 108
109static int 109static size_t
110count_defered_links_to_dev_ino (struct cpio_file_stat *file_hdr) 110count_defered_links_to_dev_ino (struct cpio_file_stat *file_hdr)
111{ 111{
112 struct deferment *d; 112 struct deferment *d;
113 ino_t ino; 113 ino_t ino = file_hdr->c_ino;
114 int maj; 114 long maj = file_hdr->c_dev_maj;
115 int min; 115 long min = file_hdr->c_dev_min;
116 int count; 116 size_t count = 0;
117 ino = file_hdr->c_ino; 117
118 maj = file_hdr->c_dev_maj;
119 min = file_hdr->c_dev_min;
120 count = 0;
121 for (d = deferouts; d != NULL; d = d->next) 118 for (d = deferouts; d != NULL; d = d->next)
122 { 119 {
123 if ( (d->header.c_ino == ino) && (d->header.c_dev_maj == maj) 120 if (d->header.c_ino == ino
124 && (d->header.c_dev_min == min) ) 121 && d->header.c_dev_maj == maj
122 && d->header.c_dev_min == min)
125 ++count; 123 ++count;
126 } 124 }
127 return count; 125 return count;
@@ -133,17 +131,9 @@ count_defered_links_to_dev_ino (struct cpio_file_stat *file_hdr)
133static int 131static int
134last_link (struct cpio_file_stat *file_hdr) 132last_link (struct cpio_file_stat *file_hdr)
135{ 133{
136 int other_files_sofar; 134 return file_hdr->c_nlink == count_defered_links_to_dev_ino (file_hdr) + 1;
137
138 other_files_sofar = count_defered_links_to_dev_ino (file_hdr);
139 if (file_hdr->c_nlink == (other_files_sofar + 1) )
140 {
141 return 1;
142 }
143 return 0;
144} 135}
145 136
146
147/* Add the file header for a link that is being defered to the deferouts 137/* Add the file header for a link that is being defered to the deferouts
148 list. */ 138 list. */
149 139
diff --git a/src/util.c b/src/util.c
index 0faccbc..c56ecf5 100644
--- a/src/util.c
+++ b/src/util.c
@@ -484,9 +484,9 @@ copy_files_disk_to_tape (int in_des, int out_des, off_t num_bytes,
484 while (num_bytes > 0) 484 while (num_bytes > 0)
485 { 485 {
486 if (input_size == 0) 486 if (input_size == 0)
487 if (rc = disk_fill_input_buffer (in_des, 487 if ((rc = disk_fill_input_buffer (in_des,
488 num_bytes < DISK_IO_BLOCK_SIZE ? 488 num_bytes < DISK_IO_BLOCK_SIZE ?
489 num_bytes : DISK_IO_BLOCK_SIZE)) 489 num_bytes : DISK_IO_BLOCK_SIZE)))
490 { 490 {
491 if (rc > 0) 491 if (rc > 0)
492 { 492 {
@@ -536,7 +536,7 @@ copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes,
536 while (num_bytes > 0) 536 while (num_bytes > 0)
537 { 537 {
538 if (input_size == 0) 538 if (input_size == 0)
539 if (rc = disk_fill_input_buffer (in_des, num_bytes)) 539 if ((rc = disk_fill_input_buffer (in_des, num_bytes)))
540 { 540 {
541 if (rc > 0) 541 if (rc > 0)
542 { 542 {

Return to:

Send suggestions and report system problems to the System administrator.