Fix: CRYPTO_THREAD_run_once
authorMat <mberchtold@gmail.com>
Fri, 1 Apr 2016 00:00:03 +0000 (02:00 +0200)
committerRich Salz <rsalz@openssl.org>
Sat, 2 Apr 2016 20:56:09 +0000 (16:56 -0400)
InitOnceExecuteOnce returns nonzero on success:
MSDN: "If the function succeeds, the return value is nonzero."

So return 1 if it is nonzero, 0 others.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/threads_win.c

index 5a14872d1ca784c74ca7aa8e805e99356af7e98e..63647a39a673dc37e3ab0bd513b82d4cb6331934 100644 (file)
@@ -136,9 +136,9 @@ BOOL CALLBACK once_cb(PINIT_ONCE once, PVOID p, PVOID *pp)
 int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
 {
     if (InitOnceExecuteOnce(once, once_cb, init, NULL))
-        return 0;
+        return 1;
 
-    return 1;
+    return 0;
 }
 
 # endif