From: Karel Zak Date: Thu, 27 Nov 2025 15:38:18 +0000 (+0100) Subject: lsfd: fix const qualifier warning in strnrstr X-Git-Tag: v2.41.3~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0026a6661116db5599c6cdabe2b1f76335233e9;p=thirdparty%2Futil-linux.git lsfd: fix const qualifier warning in strnrstr Fix const qualifier discarded warning in strnrstr(). This warning is reported by gcc 15 which defaults to the C23 standard. The function returns a non-const pointer into the haystack parameter, and callers modify the string through that pointer. Therefore, the haystack parameter should be char * rather than const char *. Signed-off-by: Karel Zak (cherry picked from commit 935f2ab21add95059a92208f69ef578708307481) --- diff --git a/lsfd-cmd/file.c b/lsfd-cmd/file.c index 32b08693d..5ea3ccc57 100644 --- a/lsfd-cmd/file.c +++ b/lsfd-cmd/file.c @@ -387,7 +387,7 @@ void decode_source(char *buf, size_t bufsize, dev_minor); } -static char *strnrstr(const char *haystack, const char *needle, size_t needle_len) +static char *strnrstr(char *haystack, const char *needle, size_t needle_len) { char *last = strstr(haystack, needle); if (last == NULL)