]> Dogcows Code - chaz/tar/commitdiff
(delete_archive_members): Bugfix: when
authorSergey Poznyakoff <gray@gnu.org.ua>
Fri, 17 Dec 2004 16:10:36 +0000 (16:10 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Fri, 17 Dec 2004 16:10:36 +0000 (16:10 +0000)
attempting to delete an unexisting member, the last
blocking_factor blocks were zeroed.

src/delete.c

index a18f59845fc3d4ee91cfec353e526d64f5326376..a98694175aa4888deeff50a8b6699620db6edde3 100644 (file)
@@ -359,33 +359,32 @@ delete_archive_members (void)
                write_record (1);
            }
        }
-    }
 
-  if (logical_status == HEADER_END_OF_FILE)
-    {
-      /* Write the end of tape.  FIXME: we can't use write_eot here,
-        as it gets confused when the input is at end of file.  */
+      if (logical_status == HEADER_END_OF_FILE)
+       {
+         /* Write the end of tape.  FIXME: we can't use write_eot here,
+            as it gets confused when the input is at end of file.  */
 
-      int total_zero_blocks = 0;
+         int total_zero_blocks = 0;
 
-      do
+         do
+           {
+             int zero_blocks = blocking_factor - new_blocks;
+             memset (new_record + new_blocks, 0, BLOCKSIZE * zero_blocks);
+             total_zero_blocks += zero_blocks;
+             write_record (total_zero_blocks < 2);
+           }
+         while (total_zero_blocks < 2);
+       }
+
+      if (! acting_as_filter && ! _isrmt (archive))
        {
-         int zero_blocks = blocking_factor - new_blocks;
-         memset (new_record + new_blocks, 0, BLOCKSIZE * zero_blocks);
-         total_zero_blocks += zero_blocks;
-         write_record (total_zero_blocks < 2);
+         if (sys_truncate (archive))
+           truncate_warn (archive_name_array[0]);
        }
-      while (total_zero_blocks < 2);
     }
-
   free (new_record);
 
-  if (! acting_as_filter && ! _isrmt (archive))
-    {
-      if (sys_truncate (archive))
-       truncate_warn (archive_name_array[0]);
-    }
-
   close_archive ();
   names_notfound ();
 }
This page took 0.027088 seconds and 4 git commands to generate.