summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-08-28 05:28:19 +0000
committerkientzle <kientzle@FreeBSD.org>2004-08-28 05:28:19 +0000
commit655e07d67c4dee13cf1de41f99a818b097c24190 (patch)
treea25e9dedbe3e7fbbb38595ac1a029f73966cc0ea /usr.bin/tar
parenta6ba8197504f655d03cdfd61b3a036d6c41bdd55 (diff)
downloadFreeBSD-src-655e07d67c4dee13cf1de41f99a818b097c24190.zip
FreeBSD-src-655e07d67c4dee13cf1de41f99a818b097c24190.tar.gz
Make -C and -T work correctly together.
MFC after: 3 days Thanks to: Guy Helmer
Diffstat (limited to 'usr.bin/tar')
-rw-r--r--usr.bin/tar/write.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index 3a52248..e1e0a23 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -427,14 +427,15 @@ static int
archive_names_from_file_helper(struct bsdtar *bsdtar, const char *line)
{
if (bsdtar->next_line_is_dir) {
- if (chdir(line) != 0)
- bsdtar_errc(bsdtar, 1, errno,
- "chdir(%s) failed", line);
+ set_chdir(bsdtar, line);
bsdtar->next_line_is_dir = 0;
} else if (!bsdtar->option_null && strcmp(line, "-C") == 0)
bsdtar->next_line_is_dir = 1;
- else
+ else {
+ if (*line != '/')
+ do_chdir(bsdtar); /* Handle a deferred -C */
write_heirarchy(bsdtar, bsdtar->archive, line);
+ }
return (0);
}
OpenPOWER on IntegriCloud