ccan/io: fix io_connect.
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 3 Aug 2014 00:25:01 +0000 (09:55 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 3 Aug 2014 00:25:01 +0000 (09:55 +0930)
commit12e924346b342c61219a3fdc57eb6b00a27f1cd1
tree9f022565be86c30cfec2ec218a16e9ec0655036c
parent79ac0049672b1f27b1a7121d06cc38721f76b8e1
ccan/io: fix io_connect.

getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &len) gives err == ECONNREFUSED
when connection is refused.  Handle this (and other error cases).

And we need F_SETFL not F_SETFD to restore blocking on the socket!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/io/io.c