git: 4881c7a65057 - main - tests/sys/kern/unix_stream: fix bad assertion

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Sun, 30 Aug 2026 18:26:12 UTC
The branch main has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=4881c7a650571eeb4cd89b5af4c1d3e922a67706

commit 4881c7a650571eeb4cd89b5af4c1d3e922a67706
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-08-19 15:31:02 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-08-30 18:25:23 +0000

    tests/sys/kern/unix_stream: fix bad assertion
    
    kqueue returns a value != -1 on error. Test for that instead of any
    non-zero value to confirm that success was achieved when calling
    `kqueue`.
    
    This issue exists with ATF 0.22+ [1].
    
    MFC after:      2 weeks
    Reported by:    clang (-Wparenthesis)
    
    [1]: https://github.com/freebsd/atf/pull/72
---
 tests/sys/kern/unix_stream.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/sys/kern/unix_stream.c b/tests/sys/kern/unix_stream.c
index df8dd1a15f85..5061150b62e1 100644
--- a/tests/sys/kern/unix_stream.c
+++ b/tests/sys/kern/unix_stream.c
@@ -518,7 +518,8 @@ ATF_TC_BODY(ourshutdown_kevent, tc)
 	int sv[2], kq;
 
 	do_socketpair(sv);
-	ATF_REQUIRE(kq = kqueue());
+	kq = kqueue();
+	ATF_REQUIRE(kq != -1);
 
 	EV_SET(&kev, sv[1], EVFILT_WRITE, EV_ADD, 0, 0, NULL);
 	ATF_REQUIRE(kevent(kq, &kev, 1, NULL, 0, NULL) == 0);