git: 766061eea071 - stable/14 - modstat: check errno before calling feature_present

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Mon, 16 Nov 2026 18:12:54 UTC
The branch stable/14 has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=766061eea07161010d777d985700f988e3824f87

commit 766061eea07161010d777d985700f988e3824f87
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-13 10:24:17 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-16 15:57:43 +0000

    modstat: check errno before calling feature_present
    
    feature_present will overwrite errno if COMPAT_FREEBSD13 is not present.
    
    Reported by:    llm-postcr
    Fixes:          ef726c645300 ("modstat: allow compat support to fail in tests")
    
    (cherry picked from commit acd270c8c6542b45e404078b28e1a732106aa76c)
---
 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"));
 	}
 }