diff options
-rw-r--r-- | apps/s_time.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/s_time.c b/apps/s_time.c index 386a81a78e..60861642f5 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -127,7 +127,7 @@ int s_time_main(int argc, char **argv) int maxtime = SECONDS, nConn = 0, perform = 3, ret = 1, i, st_bugs = 0; long bytes_read = 0, finishtime = 0; OPTION_CHOICE o; - int min_version = 0, max_version = 0, ver, buf_len; + int min_version = 0, max_version = 0, ver, buf_len, fd; size_t buf_size; meth = TLS_client_method(); @@ -346,7 +346,8 @@ int s_time_main(int argc, char **argv) continue; } SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); - BIO_closesocket(SSL_get_fd(scon)); + if ((fd = SSL_get_fd(scon)) >= 0) + BIO_closesocket(fd); nConn = 0; totalTime = 0.0; @@ -373,7 +374,8 @@ int s_time_main(int argc, char **argv) bytes_read += i; } SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); - BIO_closesocket(SSL_get_fd(scon)); + if ((fd = SSL_get_fd(scon)) >= 0) + BIO_closesocket(fd); nConn += 1; if (SSL_session_reused(scon)) { |