summaryrefslogtreecommitdiff
path: root/netlib.c
diff options
context:
space:
mode:
authorMichael Tatarinov <kukabu@gmail.com>2011-06-27 10:34:28 +0400
committerEric S. Raymond <esr@thyrsus.com>2011-06-27 02:36:56 -0400
commit5ab7d662b32628f6e198f2d43c1030a0a852e07f (patch)
tree4dae9933fa06f8b45295951aa39016275de4e8ca /netlib.c
parent4864719b1e1b83601999fe82bd0dd3b32534efe4 (diff)
downloadgpsd-5ab7d662b32628f6e198f2d43c1030a0a852e07f.tar.gz
netlib_localsocket(): close the socket if connect() failed
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Diffstat (limited to 'netlib.c')
-rw-r--r--netlib.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/netlib.c b/netlib.c
index bf4a4656..d5ca89fe 100644
--- a/netlib.c
+++ b/netlib.c
@@ -165,6 +165,7 @@ socket_t netlib_localsocket(const char *sockfile)
/*@-unrecog@*/
if (connect(sock, (struct sockaddr *)&saddr, SUN_LEN(&saddr)) < 0) {
+ (void)close(sock);
return -1;
}
/*@+unrecog@*/