summaryrefslogtreecommitdiffstats
path: root/contrib/tar/src
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2002-07-03 12:44:31 +0000
committersobomax <sobomax@FreeBSD.org>2002-07-03 12:44:31 +0000
commit364206b008d621ad5eca6df5937d6dbc641a1f95 (patch)
tree89d7551bdd916e2a191aa520de1a4ba852eb6a68 /contrib/tar/src
parent881d4d841b1b19c74290b9305b987509b428af66 (diff)
downloadFreeBSD-src-364206b008d621ad5eca6df5937d6dbc641a1f95.zip
FreeBSD-src-364206b008d621ad5eca6df5937d6dbc641a1f95.tar.gz
When we are extracting directory with --unlink option and the directory
already exists don't spew bogus "Cannot unlink" error and exit with non-zero code. Reported by: bde
Diffstat (limited to 'contrib/tar/src')
-rw-r--r--contrib/tar/src/extract.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/tar/src/extract.c b/contrib/tar/src/extract.c
index c47f4c3..3dd2fce 100644
--- a/contrib/tar/src/extract.c
+++ b/contrib/tar/src/extract.c
@@ -1140,8 +1140,12 @@ extract_archive (void)
else if (typeflag == GNUTYPE_DUMPDIR)
skip_member ();
- if (! prepare_to_extract (CURRENT_FILE_NAME))
- break;
+ {
+ struct stat st;
+ if (stat (CURRENT_FILE_NAME, &st) != 0 || !S_ISDIR (st.st_mode))
+ if (! prepare_to_extract (CURRENT_FILE_NAME))
+ break;
+ }
mode = ((current_stat.st_mode
| (we_are_root ? 0 : MODE_WXUSR))
OpenPOWER on IntegriCloud