summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2012-02-09 14:29:01 -0800
committerRuss Allbery <rra@stanford.edu>2012-02-09 14:29:01 -0800
commit90da02c0ea2fa229995ed4bb45eefbc2ae776a55 (patch)
treebafe3526335c2b469ee39fbe990470c28ec9ba44 /util
parent53d866facd69ab9bb8e0378b02913b47f1cc18ce (diff)
Update to rra-c-util 4.2 and C TAP Harness 1.9
Update to rra-c-util 4.2: * Fix error reporting for non-blocking connect. * Fix network test when short listen queues don't cause timeout. * Handle DNS failure in the getaddrinfo test suite. * Ensure config.h is included for portable/stdbool.h. * Fix compiler warnings when built with -D_FORTIFY_SOURCE=2. * Add test wrappers around asprintf and vasprintf. Update to C TAP Harness 1.9: * Add test_tmpdir and test_tmpdir_free to TAP library. * runtests now frees all allocated resources on exit. Change-Id: I7ba21798a4169bf8a7cd45f2675f9520518e7a02
Diffstat (limited to 'util')
-rw-r--r--util/network.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/util/network.c b/util/network.c
index b88f83b..595cda0 100644
--- a/util/network.c
+++ b/util/network.c
@@ -445,11 +445,15 @@ network_connect(struct addrinfo *ai, const char *source, time_t timeout)
} else if (status > 0 && FD_ISSET(fd, &set)) {
len = sizeof(err);
status = getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &len);
- if (status == 0)
- status = err;
+ if (status == 0) {
+ status = (err == 0) ? 0 : -1;
+ socket_set_errno(err);
+ }
}
}
+ oerrno = socket_errno;
fdflag_nonblocking(fd, false);
+ socket_set_errno(oerrno);
}
}
if (status == 0)