about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-02T16·17+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-02T16·17+0200
commita424ab0444540579d462856a9d7fb918ebd33603 (patch)
treee54e2de2f76ba1c133a6f66d30a4d717ac41f991 /src
parenta24f2c9b8413ebc8b1776ab3f770c69e4a03007b (diff)
createTempDir(): Don't do a chown on Linux
It's not needed and can cause problems in a user namespace.
Diffstat (limited to 'src')
-rw-r--r--src/libutil/util.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 67558cc0b33c..788d01f59a18 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -384,6 +384,7 @@ Path createTempDir(const Path & tmpRoot, const Path & prefix,
         checkInterrupt();
         Path tmpDir = tempName(tmpRoot, prefix, includePid, counter);
         if (mkdir(tmpDir.c_str(), mode) == 0) {
+#if __FreeBSD__
             /* Explicitly set the group of the directory.  This is to
                work around around problems caused by BSD's group
                ownership semantics (directories inherit the group of
@@ -394,6 +395,7 @@ Path createTempDir(const Path & tmpRoot, const Path & prefix,
                have the setgid bit set on directories. */
             if (chown(tmpDir.c_str(), (uid_t) -1, getegid()) != 0)
                 throw SysError(format("setting group of directory ‘%1%’") % tmpDir);
+#endif
             return tmpDir;
         }
         if (errno != EEXIST)