]> Dogcows Code - chaz/tar/blobdiff - src/create.c
(dump_file0): Check for is_avoided_name() first. Fixes bug reported by Martin Lohmeier
[chaz/tar] / src / create.c
index 505dca33cfcac2055ecf4371fa3210a90067392e..c9be71cf6587d6a3150cc24e0895aad4a9611a90 100644 (file)
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
-   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include <system.h>
 
@@ -886,9 +886,9 @@ dump_regular_file (int fd, struct tar_stat_info *st)
          return dump_status_short;
        }
       size_left -= count;
-
-      set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
-
+      if (count)
+       set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
+      
       if (count != bufsize)
        {
          char buf[UINTMAX_STRSIZE_BOUND];
@@ -901,7 +901,7 @@ dump_regular_file (int fd, struct tar_stat_info *st)
                 STRINGIFY_BIGINT (size_left, buf)));
          if (! ignore_failed_read_option)
            exit_status = TAREXIT_FAILURE;
-         pad_archive (size_left);
+         pad_archive (size_left - (bufsize-count));
          return dump_status_short;
        }
     }
@@ -1211,8 +1211,8 @@ create_archive (void)
 
 
 /* Calculate the hash of a link.  */
-static unsigned
-hash_link (void const *entry, unsigned n_buckets)
+static size_t
+hash_link (void const *entry, size_t n_buckets)
 {
   struct link const *l = entry;
   uintmax_t num = l->dev ^ l->ino;
@@ -1263,7 +1263,8 @@ dump_hard_link (struct tar_stat_info *st)
       if ((duplicate = hash_lookup (link_table, &lp)))
        {
          /* We found a link.  */
-         char const *link_name = safer_name_suffix (duplicate->name, true);
+         char const *link_name = safer_name_suffix (duplicate->name, true,
+                                                    absolute_names_option);
 
          duplicate->nlink--;
 
@@ -1361,7 +1362,8 @@ dump_file0 (struct tar_stat_info *st, char *p,
     return;
 
   assign_string (&st->orig_file_name, p);
-  assign_string (&st->file_name, safer_name_suffix (p, false));
+  assign_string (&st->file_name, 
+                 safer_name_suffix (p, false, absolute_names_option));
 
   if (deref_stat (dereference_option, p, &st->stat) != 0)
     {
@@ -1412,6 +1414,8 @@ dump_file0 (struct tar_stat_info *st, char *p,
       return;
     }
 
+  if (is_avoided_name (p))
+    return;
   if (S_ISDIR (st->stat.st_mode))
     {
       dump_dir (st, top_level, parent_device);
@@ -1419,8 +1423,6 @@ dump_file0 (struct tar_stat_info *st, char *p,
        utime (p, &restore_times);
       return;
     }
-  else if (is_avoided_name (p))
-    return;
   else
     {
       /* Check for multiple links.  */
This page took 0.026861 seconds and 4 git commands to generate.