Commit 95c75073 authored by Mark Johnston's avatar Mark Johnston
Browse files

netbsd-tests: Fix the libc stat_socket test

The test tries to connect a socket to a closed port at  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
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
parent 7bd2df8c
......@@ -332,9 +332,6 @@ ATF_TC_BODY(stat_socket, tc)
uint32_t iaddr;
int fd, flags;
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
(void)memset(&st, 0, sizeof(struct stat));
(void)memset(&addr, 0, sizeof(struct sockaddr_in));
......@@ -353,14 +350,14 @@ ATF_TC_BODY(stat_socket, tc)
errno = 0;
connect(fd, (struct sockaddr *)&addr,
sizeof(struct sockaddr_in)) == -1);
ATF_REQUIRE(connect(fd, (struct sockaddr *)&addr,
sizeof(struct sockaddr_in)) == -1);
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");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment