Avoid leaking file descriptors

This commit is contained in:
Matteo Riondato 2007-10-23 07:35:17 +00:00
parent e3e2d9bf7c
commit 8a06ee9ea0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172901

View File

@ -365,8 +365,10 @@ init_transport(struct netconfig *nconf)
* Skip if we have an AF_INET6 adress.
*/
if (inet_pton(AF_INET6,
hosts[nhostsbak], host_addr) == 1)
hosts[nhostsbak], host_addr) == 1) {
close(fd);
continue;
}
}
break;
case AF_INET6:
@ -378,8 +380,10 @@ init_transport(struct netconfig *nconf)
* Skip if we have an AF_INET adress.
*/
if (inet_pton(AF_INET, hosts[nhostsbak],
host_addr) == 1)
continue;
host_addr) == 1) {
close(fd);
continue;
}
}
if (setsockopt(fd, IPPROTO_IPV6,
IPV6_V6ONLY, &on, sizeof on) < 0) {