Make -C and -T work correctly together.

MFC after: 3 days
Thanks to: Guy Helmer
This commit is contained in:
Tim Kientzle 2004-08-28 05:28:19 +00:00
parent 5897f840f0
commit cb7f04cf39
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=134427

View File

@ -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);
}