aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-03 16:53:28 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-03 16:53:28 +0200
commit3800f441e49af78b95d403014459dbb9bb646e8a (patch)
treeb3317bc9288b70f429cb1a475febb01f91e96ad7 /src
parenta17c23426e7b2724639cd90c23759299cdaffbb7 (diff)
createDirs(): Handle ‘path’ being a symlink
In particular, this fixes "nix-build -o /tmp/result" on Mac OS X (where /tmp is a symlink).
Diffstat (limited to 'src')
-rw-r--r--src/libutil/util.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 0729bf647..436580651 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -383,6 +383,9 @@ Paths createDirs(const Path & path)
created.push_back(path);
}
+ if (S_ISLNK(st.st_mode) && stat(path.c_str(), &st) == -1)
+ throw SysError(format("statting symlink ‘%1%’") % path);
+
if (!S_ISDIR(st.st_mode)) throw Error(format("‘%1%’ is not a directory") % path);
return created;