about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-14T08·51+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-14T08·51+0200
commit2a4dbcff74c9af467b6d21828468dbba860dd979 (patch)
tree78543ef653438f0aaf683dfe2307ba9671fed0a5 /src/libstore/local-store.cc
parent6bb4c0b712788c9cec9a1721ceb3c3a5c89c4181 (diff)
Improved error message when encountering unsupported file types
Fixes #269.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index f91a0889250a..f08c877fe3d7 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -551,9 +551,9 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
     if (lstat(path.c_str(), &st))
         throw SysError(format("getting attributes of path ‘%1%’") % path);
 
-    /* Really make sure that the path is of a supported type.  This
-       has already been checked in dumpPath(). */
-    assert(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode));
+    /* Really make sure that the path is of a supported type. */
+    if (!(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode)))
+        throw Error(format("file ‘%1%’ has an unsupported type") % path);
 
     /* Fail if the file is not owned by the build user.  This prevents
        us from messing up the ownership/permissions of files