summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorderaadt <>2014-07-16 10:43:06 +0000
committerderaadt <>2014-07-16 10:43:06 +0000
commitd84a1e27564a0d13e29f3604bed61eac16d66068 (patch)
treedd025df9936a646c4cc0512392b4a5e112cb4e4c /src
parent2fad8aafe239844c31915cc13778f37ddffadf0c (diff)
downloadopenbsd-d84a1e27564a0d13e29f3604bed61eac16d66068.tar.gz
openbsd-d84a1e27564a0d13e29f3604bed61eac16d66068.tar.bz2
openbsd-d84a1e27564a0d13e29f3604bed61eac16d66068.zip
do not need a variable to track locking, since all code paths have it
locked throughout.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bio/b_sock.c7
-rw-r--r--src/lib/libssl/src/crypto/bio/b_sock.c7
2 files changed, 4 insertions, 10 deletions
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c
index ced0406bc1..c095943e8b 100644
--- a/src/lib/libcrypto/bio/b_sock.c
+++ b/src/lib/libcrypto/bio/b_sock.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: b_sock.c,v 1.55 2014/07/13 16:03:09 beck Exp $ */ 1/* $OpenBSD: b_sock.c,v 1.56 2014/07/16 10:43:06 deraadt Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -80,7 +80,6 @@ BIO_get_host_ip(const char *str, unsigned char *ip)
80{ 80{
81 int i; 81 int i;
82 int err = 1; 82 int err = 1;
83 int locked = 0;
84 struct hostent *he; 83 struct hostent *he;
85 84
86 if (inet_pton(AF_INET, str, ip) == 1) 85 if (inet_pton(AF_INET, str, ip) == 1)
@@ -88,7 +87,6 @@ BIO_get_host_ip(const char *str, unsigned char *ip)
88 87
89 /* do a gethostbyname */ 88 /* do a gethostbyname */
90 CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); 89 CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME);
91 locked = 1;
92 he = BIO_gethostbyname(str); 90 he = BIO_gethostbyname(str);
93 if (he == NULL) { 91 if (he == NULL) {
94 BIOerr(BIO_F_BIO_GET_HOST_IP, BIO_R_BAD_HOSTNAME_LOOKUP); 92 BIOerr(BIO_F_BIO_GET_HOST_IP, BIO_R_BAD_HOSTNAME_LOOKUP);
@@ -106,8 +104,7 @@ BIO_get_host_ip(const char *str, unsigned char *ip)
106 err = 0; 104 err = 0;
107 105
108err: 106err:
109 if (locked) 107 CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME);
110 CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME);
111 if (err) { 108 if (err) {
112 ERR_asprintf_error_data("host=%s", str); 109 ERR_asprintf_error_data("host=%s", str);
113 return 0; 110 return 0;
diff --git a/src/lib/libssl/src/crypto/bio/b_sock.c b/src/lib/libssl/src/crypto/bio/b_sock.c
index ced0406bc1..c095943e8b 100644
--- a/src/lib/libssl/src/crypto/bio/b_sock.c
+++ b/src/lib/libssl/src/crypto/bio/b_sock.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: b_sock.c,v 1.55 2014/07/13 16:03:09 beck Exp $ */ 1/* $OpenBSD: b_sock.c,v 1.56 2014/07/16 10:43:06 deraadt Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -80,7 +80,6 @@ BIO_get_host_ip(const char *str, unsigned char *ip)
80{ 80{
81 int i; 81 int i;
82 int err = 1; 82 int err = 1;
83 int locked = 0;
84 struct hostent *he; 83 struct hostent *he;
85 84
86 if (inet_pton(AF_INET, str, ip) == 1) 85 if (inet_pton(AF_INET, str, ip) == 1)
@@ -88,7 +87,6 @@ BIO_get_host_ip(const char *str, unsigned char *ip)
88 87
89 /* do a gethostbyname */ 88 /* do a gethostbyname */
90 CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); 89 CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME);
91 locked = 1;
92 he = BIO_gethostbyname(str); 90 he = BIO_gethostbyname(str);
93 if (he == NULL) { 91 if (he == NULL) {
94 BIOerr(BIO_F_BIO_GET_HOST_IP, BIO_R_BAD_HOSTNAME_LOOKUP); 92 BIOerr(BIO_F_BIO_GET_HOST_IP, BIO_R_BAD_HOSTNAME_LOOKUP);
@@ -106,8 +104,7 @@ BIO_get_host_ip(const char *str, unsigned char *ip)
106 err = 0; 104 err = 0;
107 105
108err: 106err:
109 if (locked) 107 CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME);
110 CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME);
111 if (err) { 108 if (err) {
112 ERR_asprintf_error_data("host=%s", str); 109 ERR_asprintf_error_data("host=%s", str);
113 return 0; 110 return 0;