Hi Pavel,

Thanks for noticing.  Please try the attached patch.  Let me know if it
works for you.

Regards,
Sergey

diff --git a/src/extract.c b/src/extract.c
index 2cc1f7b..ca25603 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -191,19 +191,6 @@ extr_init (void)
       umask (newdir_umask);	/* restore the kernel umask */
       current_umask = newdir_umask;
     }
-
-  /* If the user wants to guarantee that everything is under one directory,
-     determine its name now and let it be created later.  */
-  if (one_top_level_option && !one_top_level_dir)
-    {
-      char *base = base_name (archive_name_array[0]);
-
-      one_top_level_dir = strip_compression_suffix (base);
-      free (base);
-
-      if (!one_top_level_dir)
-	USAGE_ERROR ((0, 0, _("Cannot deduce top-level directory name; please set it explicitly with --one-top-level=DIR")));
-    }
 }

 /* Use fchmod if possible, fchmodat otherwise.  */
diff --git a/src/tar.c b/src/tar.c
index cd28495..f6062d5 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -2562,6 +2562,19 @@ decode_options (int argc, char **argv)
     case LIST_SUBCOMMAND:
     case DIFF_SUBCOMMAND:
     case TEST_LABEL_SUBCOMMAND:
+      /* If the user wants to guarantee that everything is under one directory,
+	 determine its name now and let it be created later.  */
+      if (one_top_level_option && !one_top_level_dir)
+	{
+	  char *base = base_name (archive_name_array[0]);
+
+	  one_top_level_dir = strip_compression_suffix (base);
+	  free (base);
+
+	  if (!one_top_level_dir)
+	    USAGE_ERROR ((0, 0,
+			  _("Cannot deduce top-level directory name; please set it explicitly with --one-top-level=DIR")));
+	}
       for (archive_name_cursor = archive_name_array;
 	   archive_name_cursor < archive_name_array + archive_names;
 	   archive_name_cursor++)

Reply via email to