]> granicus.if.org Git - curl/commitdiff
cyassl: Fix library initialization return value
authorJay Satiro <raysatiro@yahoo.com>
Mon, 30 Mar 2015 23:09:26 +0000 (19:09 -0400)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 1 Apr 2015 06:10:58 +0000 (08:10 +0200)
(Curl_cyassl_init)
- Return 1 on success, 0 in failure.

Prior to this change the fail path returned an incorrect value and the
evaluation to determine whether CyaSSL_Init had succeeded was incorrect.
Ironically that combined with the way curl_global_init tests SSL library
initialization (!Curl_ssl_init()) meant that CyaSSL having been
successfully initialized would be seen as that even though the code path
and return value in Curl_cyassl_init were wrong.

lib/vtls/cyassl.c

index a8c1ba5f3e4a6f88f70a6929a49f8cb3bea19a7e..583930cf46d185cd0f96847bcda9becd066a55dc 100644 (file)
@@ -496,10 +496,7 @@ size_t Curl_cyassl_version(char *buffer, size_t size)
 
 int Curl_cyassl_init(void)
 {
-  if(CyaSSL_Init() == 0)
-    return 1;
-
-  return -1;
+  return (CyaSSL_Init() == SSL_SUCCESS);
 }