]> Dogcows Code - chaz/tar/blobdiff - src/tar.c
Describe 1.13.18.
[chaz/tar] / src / tar.c
index fcd23a8fc5f4b045bb1399a0f669d86f5d9c38f2..e07a6060af4ae847a81573801065941434d348d0 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -132,7 +132,6 @@ enum
   GROUP_OPTION,
   MODE_OPTION,
   NEWER_MTIME_OPTION,
-  NO_RECURSE_OPTION,
   NULL_OPTION,
   OVERWRITE_OPTION,
   OWNER_OPTION,
@@ -216,7 +215,7 @@ static struct option long_options[] =
   {"newer", required_argument, 0, 'N'},
   {"newer-mtime", required_argument, 0, NEWER_MTIME_OPTION},
   {"null", no_argument, 0, NULL_OPTION},
-  {"no-recursion", no_argument, 0, NO_RECURSE_OPTION},
+  {"no-recursion", no_argument, &recursion_option, 0},
   {"no-same-owner", no_argument, &same_owner_option, -1},
   {"no-same-permissions", no_argument, &same_permissions_option, -1},
   {"numeric-owner", no_argument, &numeric_owner_option, 1},
@@ -489,6 +488,7 @@ decode_options (int argc, char **argv)
   excluded_with_slash = new_exclude ();
   excluded_without_slash = new_exclude ();
   newer_mtime_option = TYPE_MINIMUM (time_t);
+  recursion_option = FNM_LEADING_DIR;
 
   owner_option = -1;
   group_option = -1;
@@ -726,7 +726,7 @@ decode_options (int argc, char **argv)
        /* Fall through.  */
 
       case NEWER_MTIME_OPTION:
-       if (newer_mtime_option != TYPE_MINIMUM (time_t))
+       if (newer_mtime_option != TYPE_MINIMUM (time_t))
          USAGE_ERROR ((0, 0, _("More than one threshold date")));
 
        newer_mtime_option = get_date (optarg, 0);
@@ -885,10 +885,6 @@ decode_options (int argc, char **argv)
          xalloc_die ();
        break;
 
-      case NO_RECURSE_OPTION:
-       no_recurse_option = 1;
-       break;
-
       case NULL_OPTION:
        filename_terminator = '\0';
        break;
@@ -1107,6 +1103,24 @@ see the file named COPYING for details."),
     USAGE_ERROR ((0, 0,
                  _("Cannot combine --listed-incremental with --newer")));
 
+  if (volume_label_option)
+    {
+      size_t volume_label_max_len =
+       (sizeof current_header->header.name
+        - 1 /* for trailing '\0' */
+        - (multi_volume_option
+           ? (sizeof " Volume "
+              - 1 /* for null at end of " Volume " */
+              + INT_STRLEN_BOUND (int) /* for volume number */
+              - 1 /* for sign, as 0 <= volno */)
+           : 0));
+      if (volume_label_max_len < strlen (volume_label_option))
+       USAGE_ERROR ((0, 0,
+                     _("%s: Volume label is too long (limit is %lu bytes)"),
+                     quotearg_colon (volume_label_option),
+                     (unsigned long) volume_label_max_len));
+    }
+
   /* If ready to unlink hierarchies, so we are for simpler files.  */
   if (recursive_unlink_option)
     old_files_option = UNLINK_FIRST_OLD_FILES;
This page took 0.02326 seconds and 4 git commands to generate.