From 782664056cde9eea0a569dc249e8f9b01b6d2ae9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 27 Aug 2013 13:59:24 -0400 Subject: [PATCH] fix some close on -1 issues --- libs/apr/.update | 2 +- libs/apr/network_io/unix/sockets.c | 4 ++++ libs/libsndfile/.update | 2 +- libs/libsndfile/src/file_io.c | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/apr/.update b/libs/apr/.update index c106d5b06f..1aeaab4078 100644 --- a/libs/apr/.update +++ b/libs/apr/.update @@ -1 +1 @@ -Wed Nov 7 10:37:54 CST 2012 +Tue Aug 27 13:58:18 EDT 2013 diff --git a/libs/apr/network_io/unix/sockets.c b/libs/apr/network_io/unix/sockets.c index 6d24cdcf00..4cff3bbca1 100644 --- a/libs/apr/network_io/unix/sockets.c +++ b/libs/apr/network_io/unix/sockets.c @@ -32,6 +32,10 @@ static apr_status_t socket_cleanup(void *sock) { apr_socket_t *thesocket = sock; + if (thesocket && thesocket->socketdes == -1) { + return APR_SUCCESS; + } + if (close(thesocket->socketdes) == 0) { thesocket->socketdes = -1; return APR_SUCCESS; diff --git a/libs/libsndfile/.update b/libs/libsndfile/.update index 31cb06ca73..e766ea3ad3 100644 --- a/libs/libsndfile/.update +++ b/libs/libsndfile/.update @@ -1 +1 @@ -Mon Apr 16 11:52:47 CDT 2012 +Tue Aug 27 13:58:32 EDT 2013 diff --git a/libs/libsndfile/src/file_io.c b/libs/libsndfile/src/file_io.c index 4e5ee3eed6..5fb880cd26 100644 --- a/libs/libsndfile/src/file_io.c +++ b/libs/libsndfile/src/file_io.c @@ -100,6 +100,9 @@ int psf_fclose (SF_PRIVATE *psf) { int retval ; + if (psf->filedes =- -1) + return -1; /* already closed */ + if (psf->virtual_io) return 0 ;