diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2022-01-14 20:00:01 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2022-01-21 00:53:44 +0000 |
| commit | 9f192dd79cce2ea53a1cdc3ab64ea204a2fb9d84 (patch) | |
| tree | f2b204d112d37b1ffebf91c5bdde2299121367ab | |
| parent | 6d1a563281a9367eb288c3ecc74332e09bcd2b6b (diff) | |
| download | src-9f192dd79cce2ea53a1cdc3ab64ea204a2fb9d84.tar.gz src-9f192dd79cce2ea53a1cdc3ab64ea204a2fb9d84.zip | |
netbsd-tests: Fix the libc stat_socket test
The test tries to connect a socket to a closed port at 127.0.0.1. It
sets O_NONBLOCK on the socket first and expects to get EINPROGRESS from
connect(2), but this is not guaranteed, ECONNREFUSED is possible.
Handle both cases, and re-enable the test.
PR: 240621
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 95c75073d3d1ca9dcae41784453172f199bb2c0f)
| -rw-r--r-- | contrib/netbsd-tests/lib/libc/sys/t_stat.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_stat.c b/contrib/netbsd-tests/lib/libc/sys/t_stat.c index 9d0136dae50b..029ff8452d94 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_stat.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_stat.c @@ -350,14 +350,14 @@ ATF_TC_BODY(stat_socket, tc) errno = 0; - ATF_REQUIRE_ERRNO(EINPROGRESS, - connect(fd, (struct sockaddr *)&addr, - sizeof(struct sockaddr_in)) == -1); + ATF_REQUIRE(connect(fd, (struct sockaddr *)&addr, + sizeof(struct sockaddr_in)) == -1); + ATF_REQUIRE(errno == EINPROGRESS || errno == ECONNREFUSED); errno = 0; if (fstat(fd, &st) != 0 || errno != 0) - atf_tc_fail("fstat(2) failed for a EINPROGRESS socket"); + atf_tc_fail("fstat(2) failed for a socket"); (void)close(fd); } |
