aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2002-11-15 08:48:47 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2002-11-15 08:48:47 +0000
commit2666679692a9685107f49d7efb09ddb9c61ffd43 (patch)
tree584f866aeba6b4949e6ea680f1dbb0a5775ddf7f /archival
parent09eb000d7a21854e395c547420e02bd21e887042 (diff)
downloadbusybox-2666679692a9685107f49d7efb09ddb9c61ffd43.tar.gz
Dont chdir untill after we open the archive
Diffstat (limited to 'archival')
-rw-r--r--archival/tar.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/archival/tar.c b/archival/tar.c
index f9711f8df..cadab32ca 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -710,10 +710,6 @@ int tar_main(int argc, char **argv)
tar_handle->filter = filter_accept_reject_list;
}
- if ((base_dir) && (chdir(base_dir))) {
- perror_msg_and_die("Couldnt chdir");
- }
-
#ifdef CONFIG_FEATURE_TAR_CREATE
/* create an archive */
if (tar_create == TRUE) {
@@ -740,6 +736,11 @@ int tar_main(int argc, char **argv)
} else {
tar_handle->src_fd = xopen(tar_filename, O_RDONLY);
}
+
+ if ((base_dir) && (chdir(base_dir))) {
+ perror_msg_and_die("Couldnt chdir");
+ }
+
while (get_header_ptr(tar_handle) == EXIT_SUCCESS);
/* Ckeck that every file that should have been extracted was */