git: 9def2ea40c59 - stable/15 - tests/sys/kern/unix_stream: fix bad assertion

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Tue, 22 Sep 2026 06:56:17 UTC
The branch stable/15 has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=9def2ea40c590dbda76eba8b5fdc084249452b7b

commit 9def2ea40c590dbda76eba8b5fdc084249452b7b
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-08-19 15:31:02 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-09-22 06:56:09 +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
    
    (cherry picked from commit 4881c7a650571eeb4cd89b5af4c1d3e922a67706)
---
 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);