Fix available_fds when there is no AF_INET, reported by Mathieu Arnold.

pull/162/head
Nicholas Marriott 2015-10-15 09:24:25 +01:00
parent 7120ab2f16
commit f199fb6a2b
1 changed files with 6 additions and 2 deletions

View File

@ -51,8 +51,12 @@ available_fds(unsigned int n)
for (i = 0; i < n; i++) {
fds[i] = -1;
if ((fds[i] = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
ret = 1;
break;
if (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT)
fds[i] = socket(AF_INET6, SOCK_DGRAM, 0);
if (fds[i] < 0) {
ret = 1;
break;
}
}
}