aboutsummaryrefslogtreecommitdiff
path: root/lib/libarchive/archive_read_extract.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2004-06-27 05:59:15 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2004-06-27 05:59:15 +0000
commit30d140332eb16d42a53186090c5600f76f3f6af6 (patch)
tree5ddcc29b9c6dcb1db24e31574c534e2d34190b83 /lib/libarchive/archive_read_extract.c
parent861492f7ea08533c40a9cf8b4e345cb62ae2c2be (diff)
downloadsrc-30d140332eb16d42a53186090c5600f76f3f6af6.tar.gz
src-30d140332eb16d42a53186090c5600f76f3f6af6.zip
* The mode for implicitly-created dirs is now 0777 modified by the
umask in effect when the archive is closed * Correct a typo that broke implicit dir creation for non-directories. Thanks to: Garret A Wollman for pointing out my umask oversight
Notes
Notes: svn path=/head/; revision=131175
Diffstat (limited to 'lib/libarchive/archive_read_extract.c')
-rw-r--r--lib/libarchive/archive_read_extract.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libarchive/archive_read_extract.c b/lib/libarchive/archive_read_extract.c
index fbc1fdde6223..f20a75b3c50f 100644
--- a/lib/libarchive/archive_read_extract.c
+++ b/lib/libarchive/archive_read_extract.c
@@ -75,7 +75,7 @@ struct extract {
};
/* Default mode for dirs created automatically. */
-#define DEFAULT_DIR_MODE 0755
+#define DEFAULT_DIR_MODE 0777
/*
* Mode to use for newly-created dirs during extraction; the correct
* mode will be set at the end of the extraction.
@@ -221,11 +221,12 @@ void archive_extract_cleanup(struct archive *a)
{
struct fixup_entry *next, *p;
struct extract *extract;
-
+ mode_t mask;
/* Sort dir list so directories are fixed up in depth-first order. */
extract = a->extract;
p = sort_dir_list(extract->fixup_list);
+ umask(mask = umask(0)); /* Read the current umask. */
while (p != NULL) {
if (p->fixup & FIXUP_TIMES) {
@@ -237,7 +238,7 @@ void archive_extract_cleanup(struct archive *a)
utimes(p->name, times);
}
if (p->fixup & FIXUP_MODE)
- chmod(p->name, p->mode);
+ chmod(p->name, p->mode & ~mask);
if (p->fixup & FIXUP_FFLAGS)
set_fflags(a, p->name, p->mode, p->fflags_set, 0);
@@ -416,7 +417,8 @@ mkdirpath(struct archive *a, const char *path)
*p = '\0';
/* Recursively try to build the path. */
- if (mkdirpath_recursive(a, p, NULL, DEFAULT_DIR_MODE, 0))
+ if (mkdirpath_recursive(a, extract->mkdirpath.s,
+ NULL, DEFAULT_DIR_MODE, 0))
return (ARCHIVE_WARN);
return (ARCHIVE_OK);
}