summaryrefslogtreecommitdiffstats
path: root/apps/s_socket.c
diff options
context:
space:
mode:
authorPaul Yang <paulyang.inf@gmail.com>2017-06-26 01:09:46 +0800
committerBernd Edlinger <bernd.edlinger@hotmail.de>2017-06-26 15:19:12 +0200
commit9e1d5e8dff693cb2b658f66db4f10709d8364690 (patch)
treee8c348de8015a6626d5f6275cf656926367f7049 /apps/s_socket.c
parente8e5597606d10fcb5620399dd751be4ecf3dcd1d (diff)
Fix return value checking for BIO_sock_init
BIO_sock_init returns '-1' on error, not '0', so it's needed to check explicitly istead of using '!'. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/3766)
Diffstat (limited to 'apps/s_socket.c')
-rw-r--r--apps/s_socket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/s_socket.c b/apps/s_socket.c
index 1c5c13742c..b2bf244f23 100644
--- a/apps/s_socket.c
+++ b/apps/s_socket.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -62,7 +62,7 @@ int init_client(int *sock, const char *host, const char *port,
const BIO_ADDRINFO *ai = NULL;
int ret;
- if (!BIO_sock_init())
+ if (BIO_sock_init() != 1)
return 0;
ret = BIO_lookup_ex(host, port, BIO_LOOKUP_CLIENT, family, type, protocol,
@@ -161,7 +161,7 @@ int do_server(int *accept_sock, const char *host, const char *port,
BIO_ADDRINFO *res = NULL;
int ret = 0;
- if (!BIO_sock_init())
+ if (BIO_sock_init() != 1)
return 0;
if (!BIO_lookup_ex(host, port, BIO_LOOKUP_SERVER, family, type, protocol,