summary refs log tree commit diff
path: root/nix/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-03 16:53:28 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-11 17:35:25 +0200
commitc95742283595cb01b44ddc8e6ff5e9c1d66db444 (patch)
treeeea6b53648bf11966b2ac40438f336aa110267f9 /nix/libutil
parent6092a48603ea7888f8a1f69db87835bc339c973a (diff)
downloadguix-c95742283595cb01b44ddc8e6ff5e9c1d66db444.tar.gz
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 'nix/libutil')
-rw-r--r--nix/libutil/util.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index 54b9eb82d6..9af42a150c 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -379,6 +379,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;