]> git.gag.com Git - debian/tar/commitdiff
Fix coredump on FreeBSD when TAR_OPTIONS is set
authorSergey Poznyakoff <gray@gnu.org>
Tue, 10 Nov 2015 16:25:47 +0000 (18:25 +0200)
committerSergey Poznyakoff <gray@gnu.org>
Tue, 10 Nov 2015 16:25:47 +0000 (18:25 +0200)
* src/tar.c (parse_default_options): Use program_name instead of
program_invocation_short_name.  On some systems the latter is NULL when
the function is called, which causes coredumps.
(tar_set_quoting_style): Likewise.
* src/names.c: Likewise.

src/names.c
src/tar.c

index 78ad86e7ba9a7a5ec6d85305c1e18b5ecadbe5d2..6e4616d6d34ad774f039dcf2c666995042f36916 100644 (file)
@@ -472,7 +472,7 @@ handle_option (const char *str, struct name_elt const *ent)
   if (wordsplit (str, &ws, WRDSF_DEFFLAGS|WRDSF_DOOFFS))
     FATAL_ERROR ((0, 0, _("cannot split string '%s': %s"),
                  str, wordsplit_strerror (&ws)));
-  ws.ws_wordv[0] = program_invocation_short_name;
+  ws.ws_wordv[0] = (char *) program_name;
   loc.source = OPTS_FILE;
   loc.name = ent->v.file.name;
   loc.line = ent->v.file.line;
index 83c72888b89927aeee15f61f8575227e61f0a477..21b0a3bf072f7b6279fa4b57cdb8bd63f9d06bff 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -265,7 +265,7 @@ tar_set_quoting_style (char *arg)
        return;
       }
   FATAL_ERROR ((0, 0,
-               _("Unknown quoting style '%s'. Try '%s --quoting-style=help' to get a list."), arg, program_invocation_short_name));
+               _("Unknown quoting style '%s'. Try '%s --quoting-style=help' to get a list."), arg, program_name));
 }
 
 \f
@@ -2491,7 +2491,7 @@ parse_default_options (void)
                  wordsplit_strerror (&ws)));
   if (ws.ws_wordc)
     {
-      ws.ws_wordv[0] = program_invocation_short_name;
+      ws.ws_wordv[0] = (char*) program_name;
       more_options (ws.ws_offs + ws.ws_wordc, ws.ws_wordv, &loc);
     }