Re: [PATCH] tests/qtest: fix discarded const qualifier warning

Thomas Huth <[email protected]> Fri, 15 May 2026 16:10:47 +0200
Newsgroups org.nongnu.qemu-trivial,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 14/05/2026 21.19, Matthew Penney wrote:
> Modern compilers warn that the result of strstr() may discard
> const qualifiers when assigned to a non-const pointer.
> 
> Make 'found' a const char * to fix the warning.
> 
> Signed-off-by: Matthew Penney <[email protected]>
> ---
>   tests/qtest/libqtest.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
> index bf9284b9a1..b1e06ea364 100644
> --- a/tests/qtest/libqtest.c
> +++ b/tests/qtest/libqtest.c
> @@ -2146,7 +2146,7 @@ bool mkimg(const char *file, const char *fmt, unsigned size_mb)
>   bool qtest_verbose(const char *domain)
>   {
>       const char *log = getenv("QTEST_LOG");
> -    char *found;
> +    const char *found;
>   
>       assert(domain);
Reviewed-by: Thomas Huth <[email protected]>
Tested-by: Thomas Huth <[email protected]>