about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 5b6fb62026c7..108c054b7f41 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -135,6 +135,15 @@ Path readLink(const Path & path)
 }
 
 
+bool isLink(const Path & path)
+{
+    struct stat st;
+    if (lstat(path.c_str(), &st))
+        throw SysError(format("getting status of `%1%'") % path);
+    return S_ISLNK(st.st_mode);
+}
+
+
 Strings readDirectory(const Path & path)
 {
     Strings names;