Correctly initialize fd using -1

(upstream git commit 7d659d4bd624b3100b0c0852039648d7803cbaf9)
This commit is contained in:
dcoppa 2012-03-29 13:54:17 +00:00
parent 7efbea79f1
commit b7adff3b5f
2 changed files with 28 additions and 1 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.29 2012/03/20 14:27:45 dcoppa Exp $
# $OpenBSD: Makefile,v 1.30 2012/03/29 13:54:17 dcoppa Exp $
COMMENT = console client for pandora
DISTNAME = pianobar-2012.03.17
EXTRACT_SUFX = .tar.bz2
REVISION = 0
CATEGORIES = audio
MAINTAINER = David Coppa <dcoppa@openbsd.org>

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-src_libwaitress_waitress_c,v 1.1 2012/03/29 13:54:17 dcoppa Exp $
Correctly initialize fd using -1
(upstream git commit 7d659d4bd624b3100b0c0852039648d7803cbaf9)
--- src/libwaitress/waitress.c.orig Thu Mar 29 15:45:05 2012
+++ src/libwaitress/waitress.c Thu Mar 29 15:47:03 2012
@@ -1063,6 +1063,7 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *
/* 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 *
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 &&