]> Dogcows Code - chaz/tar/blobdiff - src/buffer.c
(new_volume): Prompt the user for archive name if unable to open next archive.
[chaz/tar] / src / buffer.c
index 1b36051e19c784f7e5588162c8f7b06a92ea2f3c..81efe323eff270b531b486584ff12554068fe355 100644 (file)
@@ -966,7 +966,8 @@ new_volume (enum access_mode mode)
 {
   static FILE *read_file;
   static int looped;
-
+  int prompt;
+  
   if (!read_file && !info_script_option)
     /* FIXME: if fopen is used, it will never be closed.  */
     read_file = archive == STDIN_FILENO ? fopen (TTY_NAME, "r") : stdin;
@@ -989,9 +990,10 @@ new_volume (enum access_mode mode)
       archive_name_cursor = archive_name_array;
       looped = 1;
     }
-
+  prompt = looped;
+  
  tryagain:
-  if (looped)
+  if (prompt)
     {
       /* We have to prompt from now on.  */
 
@@ -1041,6 +1043,7 @@ new_volume (enum access_mode mode)
       open_warn (*archive_name_cursor);
       if (!verify_option && mode == ACCESS_WRITE && backup_option)
        undo_last_backup ();
+      prompt = 1;
       goto tryagain;
     }
 
@@ -1285,10 +1288,10 @@ add_chunk_header ()
 
       block_ordinal = current_block_ordinal ();
       blk = start_header (&st);
-      free (st.orig_file_name);
       if (!blk)
        abort (); /* FIXME */
       finish_header (&st, blk, block_ordinal);
+      free (st.orig_file_name);
     }
 }
 
This page took 0.019899 seconds and 4 git commands to generate.