diff options
Diffstat (limited to 'src/usr.bin/openssl/s_socket.c')
-rw-r--r-- | src/usr.bin/openssl/s_socket.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c index 5d90fad8bb..f22c88d228 100644 --- a/src/usr.bin/openssl/s_socket.c +++ b/src/usr.bin/openssl/s_socket.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_socket.c,v 1.11 2019/06/28 13:35:02 deraadt Exp $ */ | 1 | /* $OpenBSD: s_socket.c,v 1.12 2021/08/29 12:33:15 tb 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 | * |
@@ -132,7 +132,7 @@ init_client(int *sock, char *host, char *port, int type, int af) | |||
132 | int | 132 | int |
133 | do_server(int port, int type, int *ret, | 133 | do_server(int port, int type, int *ret, |
134 | int (*cb) (char *hostname, int s, unsigned char *context), | 134 | int (*cb) (char *hostname, int s, unsigned char *context), |
135 | unsigned char *context) | 135 | unsigned char *context, int naccept) |
136 | { | 136 | { |
137 | int sock; | 137 | int sock; |
138 | char *name = NULL; | 138 | char *name = NULL; |
@@ -161,7 +161,9 @@ do_server(int port, int type, int *ret, | |||
161 | shutdown(sock, SHUT_RDWR); | 161 | shutdown(sock, SHUT_RDWR); |
162 | close(sock); | 162 | close(sock); |
163 | } | 163 | } |
164 | if (i < 0) { | 164 | if (naccept != -1) |
165 | naccept--; | ||
166 | if (i < 0 || naccept == 0) { | ||
165 | shutdown(accept_socket, SHUT_RDWR); | 167 | shutdown(accept_socket, SHUT_RDWR); |
166 | close(accept_socket); | 168 | close(accept_socket); |
167 | return (i); | 169 | return (i); |