From: Cédric Le Goater Date: Mon, 15 Dec 2025 10:19:36 +0000 (+0100) Subject: monitor: Fix const qualifier build errors with recent glibc X-Git-Tag: v10.2.0-rc4~2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfe87815ba450228811f3abc633d7dc02757922e;p=thirdparty%2Fqemu.git monitor: Fix const qualifier build errors with recent glibc A recent change in glibc 2.42.9000 [1] changes the return type of strchr() and other string functions to be 'const char *' when the input is a 'const char *'. This breaks the build in : ../monitor/hmp.c:589:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 589 | p = strchr(type, ':'); | ^ Fix this by changing the type of the variables that store the result of these functions to 'const char *'. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690 Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Link: https://lore.kernel.org/qemu-devel/20251215101937.281722-4-clg@redhat.com Signed-off-by: Cédric Le Goater --- diff --git a/monitor/hmp.c b/monitor/hmp.c index 34e2b8f748..a3ee02e52c 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -577,10 +577,11 @@ static const char *get_command_name(const char *cmdline, * Read key of 'type' into 'key' and return the current * 'type' pointer. */ -static char *key_get_info(const char *type, char **key) +static const char *key_get_info(const char *type, char **key) { size_t len; - char *p, *str; + const char *p; + char *str; if (*type == ',') { type++;