Sat, 04 Feb 2017 10:06:25 +0100
check close return value
src/server/daemon/httplistener.c | file | annotate | diff | comparison | revisions | |
src/server/daemon/sessionhandler.c | file | annotate | diff | comparison | revisions |
--- a/src/server/daemon/httplistener.c Mon Jan 30 20:54:20 2017 +0100 +++ b/src/server/daemon/httplistener.c Sat Feb 04 10:06:25 2017 +0100 @@ -417,7 +417,7 @@ case SSL_ERROR_WANT_ACCEPT: errstr = "SSL_ERROR_WANT_ACCEPT"; break; case SSL_ERROR_WANT_X509_LOOKUP: errstr = "SSL_ERROR_WANT_X509_LOOKUP"; break; case SSL_ERROR_SYSCALL: errstr = "SSL_ERROR_SYSCALL"; break; - case SSL_ERROR_SSL: errstr = "SL_ERROR_SSL"; break; + case SSL_ERROR_SSL: errstr = "SSL_ERROR_SSL"; break; } log_ereport(LOG_VERBOSE, "SSL accept error[%d]: %s", error, errstr); free(conn);
--- a/src/server/daemon/sessionhandler.c Mon Jan 30 20:54:20 2017 +0100 +++ b/src/server/daemon/sessionhandler.c Sat Feb 04 10:06:25 2017 +0100 @@ -55,7 +55,12 @@ } void connection_close(Connection *conn) { - close(conn->fd); + while(close(conn->fd)) { + if(errno != EINTR) { + log_ereport(LOG_VERBOSE, "connection close failed: %s", strerror(errno)); + break; + } + } } int connection_ssl_read(Connection *conn, void *buf, int len) { @@ -82,7 +87,12 @@ log_ereport(LOG_VERBOSE, "SSL_shutdown failed: %d", conn->ssl_error); } } - close(conn->fd); + while(close(conn->fd)) { + if(errno != EINTR) { + log_ereport(LOG_VERBOSE, "connection close failed: %s", strerror(errno)); + break; + } + } } void connection_destroy(Connection *conn) { @@ -320,7 +330,7 @@ int r = handle_request(request, NULL); if(r != 0) { // TODO: error message - close(request->connection->fd); + connection_destroy(request->connection); } /*