Commit fc8acdbb authored by Rusty Russell's avatar Rusty Russell

net: fix async connect to non-listening port.

In this case, Linux (at least, Ubuntu 13.10, x86-64 kernel 3.11.0-14-generic)
sets POLLHUP and gives no other error notification.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 12ab8115
......@@ -148,6 +148,17 @@ int net_connect_complete(struct pollfd pfds[2])
if (pfds[i].fd == -1)
continue;
if (pfds[i].revents & POLLHUP) {
/* Linux gives this if connecting to local
* non-listening port */
close(pfds[i].fd);
pfds[i].fd = -1;
if (pfds[!i].fd == -1) {
errno = ECONNREFUSED;
return -1;
}
continue;
}
if (getsockopt(pfds[i].fd, SOL_SOCKET, SO_ERROR, &err,
&errlen) != 0) {
net_connect_abort(pfds);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment