about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-05-30T18·39+0200
committerEelco Dolstra <edolstra@gmail.com>2017-05-30T18·39+0200
commit683a499ebbb3d5e8803feeab9097930a9ce91d3f (patch)
tree2f8d3aa26a6f35cc2713071b9c2013d421504ca3
parentacc889c82179e96537ebe1494ec13b9536d579ca (diff)
resolve-system-dependencies: Fix another segfault
runResolver() was barfing on directories like
/System/Library/Frameworks/Security.framework/Versions/Current/PlugIns. It
should probably do something sophisticated for frameworks, but let's
ignore them for now.
-rw-r--r--src/resolve-system-dependencies/resolve-system-dependencies.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/resolve-system-dependencies/resolve-system-dependencies.cc b/src/resolve-system-dependencies/resolve-system-dependencies.cc
index 61504298608b..b04595732b92 100644
--- a/src/resolve-system-dependencies/resolve-system-dependencies.cc
+++ b/src/resolve-system-dependencies/resolve-system-dependencies.cc
@@ -53,6 +53,11 @@ std::set<std::string> runResolver(const Path & filename)
     if (fstat(fd.get(), &st))
         throw SysError("statting ‘%s’", filename);
 
+    if (!S_ISREG(st.st_mode)) {
+        printError("file ‘%s’ is not a regular file", filename);
+        return {};
+    }
+
     if (st.st_size < sizeof(mach_header_64)) {
         printError("file ‘%s’ is too short for a MACH binary", filename);
         return {};