summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/tar
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-03-24 19:01:25 +0000
committerache <ache@FreeBSD.org>1995-03-24 19:01:25 +0000
commit536b3a6b2ad3c3b94d86839f584c9762503c0c86 (patch)
treebea596b53769afe4aa081bdd17a45c4c0282203e /gnu/usr.bin/tar
parent857b1d7800b86f22b02eb7072ec82b8bdec5f0d3 (diff)
downloadFreeBSD-src-536b3a6b2ad3c3b94d86839f584c9762503c0c86.zip
FreeBSD-src-536b3a6b2ad3c3b94d86839f584c9762503c0c86.tar.gz
Fix -C arg overriding when -T file used
Diffstat (limited to 'gnu/usr.bin/tar')
-rw-r--r--gnu/usr.bin/tar/tar.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gnu/usr.bin/tar/tar.c b/gnu/usr.bin/tar/tar.c
index 33604bf..6a7f8a2 100644
--- a/gnu/usr.bin/tar/tar.c
+++ b/gnu/usr.bin/tar/tar.c
@@ -990,9 +990,10 @@ name_gather ()
{
if (*p == '-' && p[1] == 'C' && p[2] == '\0')
{
- chdir_name = name_next (0);
p = name_next (0);
- if (!p)
+ chdir_name = p ? strdup(p) : p;
+ p = name_next (0);
+ if (!chdir_name)
{
msg ("Missing file name after -C");
exit (EX_ARGSBAD);
@@ -1034,7 +1035,8 @@ addname (name)
if (name[0] == '-' && name[1] == 'C' && name[2] == '\0')
{
- chdir_name = name_next (0);
+ name = name_next (0);
+ chdir_name = name ? strdup(name) : name;
name = name_next (0);
if (!chdir_name)
{
OpenPOWER on IntegriCloud