X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fio%2Fio.c;h=8e2695292bb158a15130c0754dbbee94ac2bfb71;hp=bac08c9f9effd984c6297da04af9211d2e5c8ba3;hb=12e924346b342c61219a3fdc57eb6b00a27f1cd1;hpb=79ac0049672b1f27b1a7121d06cc38721f76b8e1 diff --git a/ccan/io/io.c b/ccan/io/io.c index bac08c9f..8e269529 100644 --- a/ccan/io/io.c +++ b/ccan/io/io.c @@ -385,10 +385,13 @@ static int do_connect(int fd, struct io_plan *plan) if (err == 0) { /* Restore blocking if it was initially. */ - fcntl(fd, F_SETFD, plan->u1.s); + fcntl(fd, F_SETFL, plan->u1.s); return 1; - } - return 0; + } else if (err == EINPROGRESS) + return 0; + + errno = err; + return -1; } struct io_plan io_connect_(int fd, const struct addrinfo *addr,