summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/htslib.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/htslib.c b/src/htslib.c
index a416dcd..51ea004 100644
--- a/src/htslib.c
+++ b/src/htslib.c
@@ -2479,9 +2479,15 @@ HTS_INLINE void deletesoc(T_SOC soc) {
DEBUG_W("close %d\n" _ (int) soc);
#endif
#ifdef _WIN32
- closesocket(soc);
+ if (closesocket(soc) != 0) {
+ int err = WSAGetLastError();
+ fprintf(stderr, "* error closing socket %d: %s\n", soc, strerror(err));
+ }
#else
- close(soc);
+ if (close(soc) != 0) {
+ const int err = errno;
+ fprintf(stderr, "* error closing socket %d: %s\n", soc, strerror(err));
+ }
#endif
#if HTS_WIDE_DEBUG
DEBUG_W(".. done\n");