diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2012-03-27 16:53:37 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2012-03-27 16:53:37 +0200 |
commit | 7d659d4bd624b3100b0c0852039648d7803cbaf9 (patch) | |
tree | 79e9e84235074b9668b0a91cd699b9ab222d25cf /src/libwaitress | |
parent | 7a02354513acad9e315b4f4f736b77a08de363a6 (diff) | |
download | pianobar-windows-7d659d4bd624b3100b0c0852039648d7803cbaf9.tar.gz pianobar-windows-7d659d4bd624b3100b0c0852039648d7803cbaf9.tar.bz2 pianobar-windows-7d659d4bd624b3100b0c0852039648d7803cbaf9.zip |
Initialize fd correctly with -1
Thanks to Perette Barella.
Diffstat (limited to 'src/libwaitress')
-rw-r--r-- | src/libwaitress/waitress.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c index a971487..b2b7d93 100644 --- a/src/libwaitress/waitress.c +++ b/src/libwaitress/waitress.c @@ -1063,6 +1063,7 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) { /* initialize */ memset (&waith->request, 0, sizeof (waith->request)); + waith->request.sockfd = -1; waith->request.dataHandler = WaitressHandleIdentity; waith->request.read = WaitressOrdinaryRead; waith->request.write = WaitressOrdinaryWrite; @@ -1104,7 +1105,9 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) { gnutls_deinit (waith->request.tlsSession); gnutls_certificate_free_credentials (waith->tlsCred); } - close (waith->request.sockfd); + if (waith->request.sockfd != -1) { + close (waith->request.sockfd); + } free (waith->request.buf); if (wRet == WAITRESS_RET_OK && |