git: 4aea6ea2eb40 - main - tests/sys/netinet/tcp_socket: fix build with ATF 0.22+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Sep 2026 07:39:47 UTC
The branch main has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=4aea6ea2eb400737837ff8d22c25688f88c7966c
commit 4aea6ea2eb400737837ff8d22c25688f88c7966c
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-09-02 07:38:17 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-09-02 07:39:24 +0000
tests/sys/netinet/tcp_socket: fix build with ATF 0.22+
Confirm that creating clients/sockets was successful by testing the
result separate from the assignment and test that the return value is
not -1 instead of testing that the value returned is non-zero.
This fixes the build with [ATF 0.22+][1].
MFC after: 2 weeks
Reported by: clang (-Wparenthesis)
Reviewed by: tuexen, cc
Differential Revision: https://reviews.freebsd.org/D59284
[1]: https://github.com/freebsd/atf/pull/72
---
tests/sys/netinet/tcp_socket.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tests/sys/netinet/tcp_socket.c b/tests/sys/netinet/tcp_socket.c
index 668a3915adb7..b330f1361799 100644
--- a/tests/sys/netinet/tcp_socket.c
+++ b/tests/sys/netinet/tcp_socket.c
@@ -45,8 +45,10 @@ ATF_TC_BODY(implied_connect, tc)
socklen_t len;
int s, c, a;
- ATF_REQUIRE(s = socket(PF_INET, SOCK_STREAM, 0));
- ATF_REQUIRE(c = socket(PF_INET, SOCK_STREAM, 0));
+ s = socket(PF_INET, SOCK_STREAM, 0);
+ ATF_REQUIRE(s != -1);
+ c = socket(PF_INET, SOCK_STREAM, 0);
+ ATF_REQUIRE(c != -1);
ATF_REQUIRE(bind(s, (struct sockaddr *)&sin, sizeof(sin)) == 0);
len = sizeof(sin);
@@ -86,8 +88,10 @@ ATF_TC_BODY(getsockname_disconnected, tc)
socklen_t len;
int s, c, a;
- ATF_REQUIRE(s = socket(PF_INET, SOCK_STREAM, 0));
- ATF_REQUIRE(c = socket(PF_INET, SOCK_STREAM, 0));
+ s = socket(PF_INET, SOCK_STREAM, 0);
+ ATF_REQUIRE(s != -1);
+ c = socket(PF_INET, SOCK_STREAM, 0);
+ ATF_REQUIRE(c != -1);
ATF_REQUIRE(bind(s, (struct sockaddr *)&sin, sizeof(sin)) == 0);
len = sizeof(sin);