changeset 52:17fb9ff8e072

Carry out EPERM test only if Apple
author Chris Cannam
date Mon, 05 Nov 2018 13:35:45 +0000
parents dd193244d97d
children 0d2d3c89fdf6
files src/helper.cpp
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/helper.cpp	Fri Nov 02 14:39:51 2018 +0000
+++ b/src/helper.cpp	Mon Nov 05 13:35:45 2018 +0000
@@ -250,17 +250,24 @@
                 code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND;
             }
         }
-#else
-        if (!libraryExists(soname)) {
-            code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND;
-        } else if (errno == EPERM) {
+#else  // !_WIN32
+#ifdef __APPLE__
+        if (errno == EPERM) {
             // This may be unreliable, but it seems to be set by
             // something dlopen() calls in the case where a library
             // can't be loaded for code-signing-related reasons on
             // macOS
             code = PluginCheckCode::FAIL_FORBIDDEN;
+        } else if (!libraryExists(soname)) {
+            code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND;
         }
-#endif
+#else  // !__APPLE__
+        if (!libraryExists(soname)) {
+            code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND;
+        }
+#endif // !__APPLE__
+#endif // !_WIN32
+
         return { code, message };
     }