about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-20T19·27-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-20T19·27-0400
commit56e30e161cd309addb5aa95ba02a8d3371846228 (patch)
tree55096253401937146eb89c8ef22433f68d63c3e4 /src/libutil/util.cc
parentf0eab0636b73a4f16b7639d30956d9072d5573cb (diff)
In the chroot, make all mounted filesystems private
This is required on systemd, which mounts filesystems as "shared"
subtrees.  Changes to shared trees in a private mount namespace are
propagated to the outside world, which is bad.
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 9d8e4afed37d..fe4fedfa597d 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -224,12 +224,12 @@ string readFile(int fd)
 }
 
 
-string readFile(const Path & path)
+string readFile(const Path & path, bool drain)
 {
     AutoCloseFD fd = open(path.c_str(), O_RDONLY);
     if (fd == -1)
         throw SysError(format("opening file `%1%'") % path);
-    return readFile(fd);
+    return drain ? drainFD(fd) : readFile(fd);
 }