git: 3157501c49be - releng/15.2 - modstat: check errno before calling feature_present

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Tue, 17 Nov 2026 19:51:59 UTC
The branch releng/15.2 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=3157501c49be8215fc251ac567d391c09817d494

commit 3157501c49be8215fc251ac567d391c09817d494
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-13 10:24:17 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-11-17 19:51:35 +0000

    modstat: check errno before calling feature_present
    
    feature_present will overwrite errno if COMPAT_FREEBSD13 is not present.
    
    Approved by:    re (cperciva)
    Reported by:    llm-postcr
    Fixes:          ef726c645300 ("modstat: allow compat support to fail in tests")
    
    (cherry picked from commit acd270c8c6542b45e404078b28e1a732106aa76c)
    (cherry picked from commit ed8dc5e715fff0a0c9f60416362924315bb49381)
---
 tests/sys/kern/module_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/sys/kern/module_test.c b/tests/sys/kern/module_test.c
index b4f66ec9c953..df990b3115cb 100644
--- a/tests/sys/kern/module_test.c
+++ b/tests/sys/kern/module_test.c
@@ -187,8 +187,8 @@ ATF_TC_BODY(modstat_v2, tc)
 		if (strnlen(ms.name, sizeof(ms.name)) < sizeof(ms.name))
 			ATF_REQUIRE(modfind(ms.name) == modid);
 	} else {
-		ATF_REQUIRE(!feature_present("compat_freebsd13"));
 		ATF_REQUIRE(errno == EINVAL);
+		ATF_REQUIRE(!feature_present("compat_freebsd13"));
 	}
 }