mirror of
https://github.com/transmission/transmission
synced 2025-02-23 14:40:43 +00:00
Do not return -EINVAL
as socket value (obviously not a good idea).
Also, fix socket descriptor leak in `tr_netBindTCPImpl` if `IPV6_V6ONLY` is defined.
This commit is contained in:
parent
cefc477918
commit
12095175a1
1 changed files with 2 additions and 1 deletions
|
@ -241,7 +241,7 @@ tr_netOpenPeerSocket (tr_session * session,
|
||||||
assert (tr_address_is_valid (addr));
|
assert (tr_address_is_valid (addr));
|
||||||
|
|
||||||
if (!tr_address_is_valid_for_peers (addr, port))
|
if (!tr_address_is_valid_for_peers (addr, port))
|
||||||
return -EINVAL;
|
return TR_BAD_SOCKET; /* -EINVAL */
|
||||||
|
|
||||||
s = tr_fdSocketCreate (session, domains[addr->type], SOCK_STREAM);
|
s = tr_fdSocketCreate (session, domains[addr->type], SOCK_STREAM);
|
||||||
if (s == TR_BAD_SOCKET)
|
if (s == TR_BAD_SOCKET)
|
||||||
|
@ -350,6 +350,7 @@ tr_netBindTCPImpl (const tr_address * addr,
|
||||||
if (setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void *) &optval, sizeof (optval)) == -1)
|
if (setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void *) &optval, sizeof (optval)) == -1)
|
||||||
if (sockerrno != ENOPROTOOPT) { /* if the kernel doesn't support it, ignore it */
|
if (sockerrno != ENOPROTOOPT) { /* if the kernel doesn't support it, ignore it */
|
||||||
*errOut = sockerrno;
|
*errOut = sockerrno;
|
||||||
|
tr_netCloseSocket (fd);
|
||||||
return TR_BAD_SOCKET;
|
return TR_BAD_SOCKET;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue