소스 검색

(list_archive): Handle incremental backups in pax
format.
(decode_header): Initialize stat_info.dumpdir

Sergey Poznyakoff 19 년 전
부모
커밋
f6458a827a
1개의 변경된 파일14개의 추가작업 그리고 33개의 파일을 삭제
  1. 14 33
      src/list.c

+ 14 - 33
src/list.c

@@ -205,46 +205,21 @@ read_and (void (*do_something) (void))
 void
 list_archive (void)
 {
+  off_t block_ordinal = current_block_ordinal ();
   /* Print the header block.  */
 
   decode_header (current_header, &current_stat_info, &current_format, 0);
   if (verbose_option)
-    print_header (&current_stat_info, -1);
+    print_header (&current_stat_info, block_ordinal);
   
-  if (incremental_option && current_header->header.typeflag == GNUTYPE_DUMPDIR)
+  if (incremental_option)
     {
-      off_t size;
-      size_t written, check;
-      union block *data_block;
-
-      set_next_block_after (current_header);
-      if (multi_volume_option)
+      if (verbose_option > 2)
 	{
-	  assign_string (&save_name, current_stat_info.orig_file_name);
-	  save_totsize = current_stat_info.stat.st_size;
-	}
-      for (size = current_stat_info.stat.st_size; size > 0; size -= written)
-	{
-	  if (multi_volume_option)
-	    save_sizeleft = size;
-	  data_block = find_next_block ();
-	  if (!data_block)
-	    {
-	      ERROR ((0, 0, _("Unexpected EOF in archive")));
-	      break;		/* FIXME: What happens, then?  */
-	    }
-	  written = available_space_after (data_block);
-	  if (written > size)
-	    written = size;
-	  set_next_block_after ((union block *)
-				(data_block->buffer + written - 1));
-	  if (verbose_option > 2)
-	    list_dumpdir (data_block->buffer, written);
+	  if (current_stat_info.dumpdir)
+	    list_dumpdir (current_stat_info.dumpdir,
+			  dumpdir_size (current_stat_info.dumpdir));
 	}
-      if (multi_volume_option)
-	assign_string (&save_name, 0);
-
-      return;
     }
 
   if (multi_volume_option)
@@ -601,7 +576,13 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
       stat_info->is_sparse = true;
     }
   else
-    stat_info->is_sparse = false;
+    {
+      stat_info->is_sparse = false;
+      if ((current_format == GNU_FORMAT
+	   || current_format == OLDGNU_FORMAT)
+	  && current_header->header.typeflag == GNUTYPE_DUMPDIR)
+	get_gnu_dumpdir ();
+    }
 }
 
 /* Convert buffer at WHERE0 of size DIGS from external format to