From c4fcb11334652f00e24ee16c2d0cf848caa4f592 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 21 Jan 2026 11:56:54 +0100 Subject: [PATCH] lsfd: make sure errors array is not empty [-Werror=type-limits] MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit lsfd-cmd/error.c: In function ‘get_errno_name’: lsfd-cmd/error.c:49:30: error: comparison of unsigned expression in ‘< 0’ is always false [-Werror=type-limits] 49 | for (size_t i = 0; i < ARRAY_SIZE(errnos); i ++) { | ^ Signed-off-by: Karel Zak --- lsfd-cmd/error.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lsfd-cmd/error.c b/lsfd-cmd/error.c index ca3752c3e..7e7bc191c 100644 --- a/lsfd-cmd/error.c +++ b/lsfd-cmd/error.c @@ -46,6 +46,9 @@ static const struct errno_s errnos[] = { static const char *get_errno_name(int ern) { + if (!ARRAY_SIZE(errnos)) + return NULL; + for (size_t i = 0; i < ARRAY_SIZE(errnos); i ++) { if (errnos[i].number == ern) return errnos[i].name; -- 2.47.3