]> Dogcows Code - chaz/tar/blobdiff - src/tar.c
(decode_options): Initialize `excluded'.
[chaz/tar] / src / tar.c
index 9b73de3cce8c23b9570356fd95a481de9b4fa88d..32e8522f8d3c0c1b9a62bb98abe9ed171a9844a3 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
 
 #include <getopt.h>
 
+#include <signal.h>
+#if ! defined SIGCHLD && defined SIGCLD
+# define SIGCHLD SIGCLD
+#endif
+
 /* The following causes "common.h" to produce definitions of all the global
    variables, rather than just "extern" declarations of them.  GNU tar does
    depend on the system loader to preset all GLOBAL variables to neutral (or
@@ -447,6 +452,7 @@ decode_options (int argc, char *const *argv)
   archive_format = DEFAULT_FORMAT;
   blocking_factor = DEFAULT_BLOCKING;
   record_size = DEFAULT_BLOCKING * BLOCKSIZE;
+  excluded = new_exclude ();
 
   owner_option = -1;
   group_option = -1;
@@ -778,8 +784,8 @@ decode_options (int argc, char *const *argv)
        break;
 
       case 'X':
-       exclude_option = 1;
-       add_exclude_file (optarg);
+       if (add_exclude_file (excluded, optarg, '\n') != 0)
+         FATAL_ERROR ((0, errno, "%s", optarg));
        break;
 
       case 'z':
@@ -805,8 +811,7 @@ decode_options (int argc, char *const *argv)
        break;
 
       case EXCLUDE_OPTION:
-       exclude_option = 1;
-       add_exclude (optarg);
+       add_exclude (excluded, optarg);
        break;
 
       case GROUP_OPTION:
@@ -1116,6 +1121,11 @@ main (int argc, char *const *argv)
     xmalloc (sizeof (const char *) * allocated_archive_names);
   archive_names = 0;
 
+#ifdef SIGCHLD
+  /* System V fork+wait does not work if SIGCHLD is ignored.  */
+  signal (SIGCHLD, SIG_DFL);
+#endif
+
   init_names ();
 
   /* Decode options.  */
This page took 0.024731 seconds and 4 git commands to generate.