summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_read_extract.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-06-05 05:30:41 +0000
committerkientzle <kientzle@FreeBSD.org>2004-06-05 05:30:41 +0000
commit5b8c67e0c6be1a49dfacbd998683bb7ce43dd8dc (patch)
treee5a33bf83bcd0ae4203b06a83f4f948d8cf7436b /lib/libarchive/archive_read_extract.c
parente53e153630de87d5e8012553d6e5f399fe61d261 (diff)
downloadFreeBSD-src-5b8c67e0c6be1a49dfacbd998683bb7ce43dd8dc.zip
FreeBSD-src-5b8c67e0c6be1a49dfacbd998683bb7ce43dd8dc.tar.gz
Recognize when we've accidentally created "foo/."
and don't complain about it.
Diffstat (limited to 'lib/libarchive/archive_read_extract.c')
-rw-r--r--lib/libarchive/archive_read_extract.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/libarchive/archive_read_extract.c b/lib/libarchive/archive_read_extract.c
index 3504c8b..56e67e8 100644
--- a/lib/libarchive/archive_read_extract.c
+++ b/lib/libarchive/archive_read_extract.c
@@ -502,6 +502,18 @@ archive_read_extract_dir_create(struct archive *a, const char *name, int mode,
mkdirpath(a, name);
if (mkdir(name, mode) == 0)
return (ARCHIVE_OK);
+ /*
+ * Yes, people really do type "tar -cf - foo/." for
+ * reasons that I cannot fathom. When they do, the
+ * dir "foo" gets created in mkdirpath() and the
+ * mkdir("foo/.") just above still fails. So, I've
+ * added yet another check here to catch this
+ * particular case.
+ *
+ * There must be a better way ...
+ */
+ if (stat(name, &st) == 0 && S_ISDIR(st.st_mode))
+ return (ARCHIVE_OK);
} else {
/* Stat failed? */
archive_set_error(a, errno, "Can't test directory");
OpenPOWER on IntegriCloud