net: fix ipv4 immediate connect
[ccan] / ccan / net / net.c
index 394c4e49f2bb16024ea576b0aa68ed1376c25bcc..4c84ba7ac3b1702ac0467bb7e3fd29244eecf298 100644 (file)
@@ -116,7 +116,7 @@ int net_connect_async(const struct addrinfo *addrinfo, struct pollfd pfds[2])
                                close_noerr(pfds[i].fd);
                                return -1;
                        }
-                       return pfds[0].fd;
+                       return pfds[i].fd;
                }
        }