/* Licensed under BSD-MIT - see LICENSE file for details */
#include <ccan/net/net.h>
#include <ccan/noerr/noerr.h>
-#include <sys/types.h>
-#include <sys/socket.h>
#include <poll.h>
-#include <netdb.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
close_noerr(pfds[i].fd);
return -1;
}
- return pfds[0].fd;
+ return pfds[i].fd;
}
}
}
continue;
}
+ if (!(pfds[i].revents & POLLOUT))
+ continue;
+
if (getsockopt(pfds[i].fd, SOL_SOCKET, SO_ERROR, &err,
&errlen) != 0) {
net_connect_abort(pfds);