tests/qtest/libqtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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 <matt@matthewpenney.net>
---
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);
--
2.54.0
On 14/5/26 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 <matt@matthewpenney.net> > --- > tests/qtest/libqtest.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Hi
On Thu, May 14, 2026 at 11:20 PM Matthew Penney <matt@matthewpenney.net> 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 <matt@matthewpenney.net>
Fixes f606321be8 ("tests/qtest: Individual verbose switches")
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> 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);
>
> --
> 2.54.0
>
>
>
--
Marc-André Lureau
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 <matt@matthewpenney.net>
> ---
> 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 <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
© 2016 - 2026 Red Hat, Inc.