diff options
| author | Tim Kientzle <kientzle@FreeBSD.org> | 2004-06-05 05:30:41 +0000 |
|---|---|---|
| committer | Tim Kientzle <kientzle@FreeBSD.org> | 2004-06-05 05:30:41 +0000 |
| commit | 2474b73276a04870c821f7d92ceb034cdebf7493 (patch) | |
| tree | e5a33bf83bcd0ae4203b06a83f4f948d8cf7436b /lib/libarchive/archive_read_extract.c | |
| parent | 4845af6ce048f34e36425e4bdf70eddf75974901 (diff) | |
Notes
Diffstat (limited to 'lib/libarchive/archive_read_extract.c')
| -rw-r--r-- | lib/libarchive/archive_read_extract.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/libarchive/archive_read_extract.c b/lib/libarchive/archive_read_extract.c index 3504c8b30b31..56e67e89afa1 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"); |
