[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] fix not a string literal warning in test_xasprintf
From: |
Eric Blake |
Subject: |
Re: [PATCH] fix not a string literal warning in test_xasprintf |
Date: |
Sat, 31 Mar 2012 09:30:49 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120316 Thunderbird/11.0 |
On 03/31/2012 09:44 AM, Gilles Espinasse wrote:
> Visible with gcc-4.4.5 with defaults-format-security.patch
>
> test-xvasprintf.c: In function 'test_xasprintf':
> test-xvasprintf.c:98: warning: format not a string literal and no format
> arguments
>
> Signed-off-by: Gilles Espinasse <address@hidden>
> ---
> tests/test-xvasprintf.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tests/test-xvasprintf.c b/tests/test-xvasprintf.c
> index 4a90059..fc54d94 100644
> --- a/tests/test-xvasprintf.c
> +++ b/tests/test-xvasprintf.c
> @@ -95,7 +95,7 @@ test_xasprintf (void)
> {
> /* Silence gcc warning about zero-length format string. */
> const char *empty = "";
> - result = xasprintf (empty);
> + result = xasprintf ("%s", empty);
NACK. The whole point of this test is to make sure the format string of
"" is handled correctly, but your patch would change the format string
to non-empty.
What is really needed is a way to shut up the gcc warning, as it only
gets in the way of this test. Adding an appropriate #pragma at the top
of the file is the proper solution.
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature