comparison src/helper.cpp @ 52:17fb9ff8e072

Carry out EPERM test only if Apple
author Chris Cannam
date Mon, 05 Nov 2018 13:35:45 +0000
parents dd193244d97d
children 81ce3ba92b16
comparison
equal deleted inserted replaced
51:dd193244d97d 52:17fb9ff8e072
248 code = PluginCheckCode::FAIL_DEPENDENCY_MISSING; 248 code = PluginCheckCode::FAIL_DEPENDENCY_MISSING;
249 } else { 249 } else {
250 code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND; 250 code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND;
251 } 251 }
252 } 252 }
253 #else 253 #else // !_WIN32
254 if (!libraryExists(soname)) { 254 #ifdef __APPLE__
255 code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND; 255 if (errno == EPERM) {
256 } else if (errno == EPERM) {
257 // This may be unreliable, but it seems to be set by 256 // This may be unreliable, but it seems to be set by
258 // something dlopen() calls in the case where a library 257 // something dlopen() calls in the case where a library
259 // can't be loaded for code-signing-related reasons on 258 // can't be loaded for code-signing-related reasons on
260 // macOS 259 // macOS
261 code = PluginCheckCode::FAIL_FORBIDDEN; 260 code = PluginCheckCode::FAIL_FORBIDDEN;
262 } 261 } else if (!libraryExists(soname)) {
263 #endif 262 code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND;
263 }
264 #else // !__APPLE__
265 if (!libraryExists(soname)) {
266 code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND;
267 }
268 #endif // !__APPLE__
269 #endif // !_WIN32
270
264 return { code, message }; 271 return { code, message };
265 } 272 }
266 273
267 Result result { PluginCheckCode::SUCCESS, "" }; 274 Result result { PluginCheckCode::SUCCESS, "" };
268 275