]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
dmesg: fix const qualifier warnings in parse_callerid
authorKarel Zak <kzak@redhat.com>
Thu, 27 Nov 2025 15:33:04 +0000 (16:33 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 8 Dec 2025 13:48:07 +0000 (14:48 +0100)
Fix const qualifier discarded warnings in parse_callerid().
These warnings are reported by gcc 15 which defaults to the C23 standard.

The strchr() and strstr() functions return pointers into const strings,
so the receiving variables must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 40e6850d2b2ba2492d5f3e75656cb9bcce2806bb)

sys-utils/dmesg.c

index cccbd4067b9d378acced70129f4bb72d6c5b9a6e..cdf23b021a86a964db5649b5396419eb1702189f 100644 (file)
@@ -844,8 +844,7 @@ static const char *parse_callerid(const char *p_str, const char *end,
        const char *p_after;
        const char *p_next;
        size_t cid_size;
-       char *p_scn;
-       char *p_cid;
+       const char *p_scn, *p_cid;
 
        /* Check for PRINTK_CALLER prefix, must be before msg text */
        p_cid = strstr(p_str, DMESG_CALLER_PREFIX);