aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-11-21 11:33:23 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-11-21 11:33:23 +0100
commit653b32a78f4529daf67505aff1a6227ea1f4cd4e (patch)
tree0670ff86ed1ed411f0f222cd310ec9cc7932d878 /src/libutil
parentec45f4b82eaef8da04f4b828b2b06a77aa3f986f (diff)
parent62960f32915909a5104f2ca3a32b25fb3cfd34c7 (diff)
Merge remote-tracking branch 'origin/master' into auto-uid-allocation
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/tarfile.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc
index a7db58559..238d0a7a6 100644
--- a/src/libutil/tarfile.cc
+++ b/src/libutil/tarfile.cc
@@ -77,9 +77,7 @@ TarArchive::~TarArchive()
static void extract_archive(TarArchive & archive, const Path & destDir)
{
- int flags = ARCHIVE_EXTRACT_FFLAGS
- | ARCHIVE_EXTRACT_PERM
- | ARCHIVE_EXTRACT_TIME
+ int flags = ARCHIVE_EXTRACT_TIME
| ARCHIVE_EXTRACT_SECURE_SYMLINKS
| ARCHIVE_EXTRACT_SECURE_NODOTDOT;
@@ -98,6 +96,10 @@ static void extract_archive(TarArchive & archive, const Path & destDir)
archive_entry_copy_pathname(entry,
(destDir + "/" + name).c_str());
+ // sources can and do contain dirs with no rx bits
+ if (archive_entry_filetype(entry) == AE_IFDIR && (archive_entry_mode(entry) & 0500) != 0500)
+ archive_entry_set_mode(entry, archive_entry_mode(entry) | 0500);
+
// Patch hardlink path
const char *original_hardlink = archive_entry_hardlink(entry);
if (original_hardlink) {