Hi, tls_close() could return TLS_WANT_POLLIN, TLS_WANT_POLLOUT as well. This diff repeats the call immediately. Ok?
cvs server: Diffing . Index: fetch.c =================================================================== RCS file: /cvs/src/usr.bin/ftp/fetch.c,v retrieving revision 1.161 diff -u -p -r1.161 fetch.c --- fetch.c 28 Feb 2017 06:31:12 -0000 1.161 +++ fetch.c 2 Mar 2017 07:20:29 -0000 @@ -1031,7 +1031,9 @@ improper: cleanup_url_get: #ifndef NOSSL if (tls != NULL) { - tls_close(tls); + do { + i = tls_close(tls); + } while (i == TLS_WANT_POLLIN || i == TLS_WANT_POLLOUT); tls_free(tls); } free(full_host);