Commit d7e1df7699 for qemu.org

commit d7e1df769910da9d832dda86b01fe1363e4f4a3c
Author: Cédric Le Goater <clg@redhat.com>
Date:   Mon Dec 15 11:19:37 2025 +0100

    gdbstub: Fix const qualifier build errors with recent glibc

    A recent change in glibc 2.42.9000 [1] changes the return type of
    strstr() and other string functions to be 'const char *' when the
    input is a 'const char *'. This breaks the build in :

    ../gdbstub/user.c:322:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
      322 |     pid_placeholder = strstr(path, "%d");
          |                     ^
    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 <thuth@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Link: https://lore.kernel.org/qemu-devel/20251215101937.281722-5-clg@redhat.com
    Signed-off-by: Cédric Le Goater <clg@redhat.com>

diff --git a/gdbstub/user.c b/gdbstub/user.c
index 2e14ded3f0..e233c59816 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -317,7 +317,7 @@ static bool gdb_accept_socket(int gdb_fd)
 static int gdbserver_open_socket(const char *path, Error **errp)
 {
     g_autoptr(GString) buf = g_string_new("");
-    char *pid_placeholder;
+    const char *pid_placeholder;

     pid_placeholder = strstr(path, "%d");
     if (pid_placeholder != NULL) {