]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix OS X 10.10 unittest failure
authorVictor Julien <victor@inliniac.net>
Wed, 14 Jan 2015 22:49:54 +0000 (23:49 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 15 Jan 2015 06:17:39 +0000 (07:17 +0100)
Work around OS X 10.10 Yosemite returning EDEADLK on a rwlock wrlocked
then tested by wrtrylock. All other OS' (and versions of OS X that I
tested) seem to return EBUSY instead.

src/threads.c

index 329890157391c9830bbdf8df8280cb3a09bb8360..6e58582534f6b221f0f4797eea8d842bab09af90 100644 (file)
@@ -89,7 +89,14 @@ int ThreadMacrosTest03RWLocks(void)
     int r = 0;
     r |= SCRWLockInit(&rwl_write, NULL);
     r |= SCRWLockWRLock(&rwl_write);
+/* work around OS X 10.10 Yosemite returning EDEADLK. All other
+ * OS' (and versions of OS X that I tested) seem to return EBUSY
+ * instead. */
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__==101000
+    r |= (SCRWLockTryWRLock(&rwl_write) == EDEADLK)? 0 : 1;
+#else
     r |= (SCRWLockTryWRLock(&rwl_write) == EBUSY)? 0 : 1;
+#endif
     r |= SCRWLockUnlock(&rwl_write);
     r |= SCRWLockDestroy(&rwl_write);