git: acd270c8c654 - main - modstat: check errno before calling feature_present

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Fri, 13 Nov 2026 10:27:25 UTC
The branch main has been updated by brooks:

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

commit acd270c8c6542b45e404078b28e1a732106aa76c
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-13 10:24:17 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-13 10:27:13 +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")
---
 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"));
 	}
 }