selftests/nolibc: Return correct value when printf test fails

Correctly return 1 (the number of errors) when strcmp()
fails rather than the return value from strncmp() which is the
signed difference between the mismatching characters.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260302101815.3043-4-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
David Laight
2026-03-02 10:17:55 +00:00
committed by Thomas Weißschuh
parent 4045e7b19b
commit b42f02da2b

View File

@@ -1691,7 +1691,7 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm
}
llen += printf(" \"%s\" = \"%s\"", expected, buf);
ret = strncmp(expected, buf, c);
ret = strncmp(expected, buf, c) != 0;
result(llen, ret ? FAIL : OK);
return ret;