summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2001-09-22 00:47:09 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2001-09-22 00:47:09 +0000
commit6c9e824ce52554abd04bf4c7f8e20485ccbe2dc4 (patch)
treedb8935265ba0bcc9dcc2c395e83249796ed4dedc
parent95a4feb37b95d37e4157fbb5d09314c202fd6caa (diff)
downloadtar-6c9e824ce52554abd04bf4c7f8e20485ccbe2dc4.tar.gz
(extract_archive): When marking a directory to be updated after
symlinks, stat all directories after it in the delayed-set-stat list too, since they will be checked after symlinks. Add support for --overwrite-dir.
-rw-r--r--src/extract.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/extract.c b/src/extract.c
index 7f4628f9..3c35d80c 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -972,15 +972,19 @@ extract_archive (void)
&& (base_name (CURRENT_FILE_NAME)
== CURRENT_FILE_NAME + h->file_name_len + 1))
{
- h->after_symlinks = 1;
-
- if (stat (h->file_name, &st) != 0)
- stat_error (h->file_name);
- else
+ do
{
- h->stat_info.st_dev = st.st_dev;
- h->stat_info.st_ino = st.st_ino;
+ h->after_symlinks = 1;
+
+ if (stat (h->file_name, &st) != 0)
+ stat_error (h->file_name);
+ else
+ {
+ h->stat_info.st_dev = st.st_dev;
+ h->stat_info.st_ino = st.st_ino;
+ }
}
+ while ((h = h->next) && ! h->after_symlinks);
}
status = 0;
@@ -1144,7 +1148,9 @@ extract_archive (void)
if (status != 0)
{
if (errno == EEXIST
- && (interdir_made || old_files_option == OVERWRITE_OLD_FILES))
+ && (interdir_made
+ || old_files_option == OVERWRITE_OLD_DIRS
+ || old_files_option == OVERWRITE_OLD_FILES))
{
struct stat st;
if (stat (CURRENT_FILE_NAME, &st) == 0)
@@ -1177,6 +1183,7 @@ extract_archive (void)
directory_exists:
if (status == 0
+ || old_files_option == OVERWRITE_OLD_DIRS
|| old_files_option == OVERWRITE_OLD_FILES)
delay_set_stat (CURRENT_FILE_NAME, &current_stat,
MODE_RWX & (mode ^ current_stat.st_mode),