diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-11-06 14:13:06 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-11-06 14:13:06 -0500 |
commit | 6a70ad85340b25b5e3a224d61e4cee7277333969 (patch) | |
tree | fa7ec24ea268fb1fd5d6f611b8931320681bb87b /netlib.c | |
parent | a7280f885cdc98b06c505a8ea4e4db9bd712ca36 (diff) | |
download | gpsd-6a70ad85340b25b5e3a224d61e4cee7277333969.tar.gz |
cppcheck and Coverity cleanup (not yet complete).
All regression tests pass. PPS is live.
Diffstat (limited to 'netlib.c')
-rw-r--r-- | netlib.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -30,10 +30,9 @@ socket_t netlib_connectsock(int af, const char *host, const char *service, struct addrinfo hints; struct addrinfo *result, *rp; int ret, type, proto, one = 1; - socket_t s = -1; + socket_t s; bool bind_me; - /* cppcheck-suppress redundantAssignment */ INVALIDATE_SOCKET(s); /*@-type@*/ ppe = getprotobyname(protocol); @@ -79,8 +78,6 @@ socket_t netlib_connectsock(int af, const char *host, const char *service, else if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) == -1) { - if (s > -1) - (void)close(s); ret = NL_NOSOCKOPT; } else { if (bind_me) { @@ -96,7 +93,7 @@ socket_t netlib_connectsock(int af, const char *host, const char *service, } } - if (s > -1) { + if (!BAD_SOCKET(s)) { (void)close(s); } } |