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.
This commit is contained in:
Eelco Dolstra 2017-05-30 20:39:40 +02:00
parent acc889c821
commit 683a499ebb
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -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 {};