aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libutil/archive.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc
index 4f59c8ed5..6ad9fa238 100644
--- a/src/libutil/archive.cc
+++ b/src/libutil/archive.cc
@@ -27,6 +27,8 @@ struct ArchiveSettings : Config
#endif
"use-case-hack",
"Whether to enable a Darwin-specific hack for dealing with file name collisions."};
+ Setting<bool> preallocateContents{this, true, "preallocate-contents",
+ "Whether to preallocate files when writing objects with known size."};
};
static ArchiveSettings archiveSettings;
@@ -323,6 +325,9 @@ struct RestoreSink : ParseSink
void preallocateContents(uint64_t len)
{
+ if (!archiveSettings.preallocateContents)
+ return;
+
#if HAVE_POSIX_FALLOCATE
if (len) {
errno = posix_fallocate(fd.get(), 0, len);