[flashrom] [PATCH] Avoid bogus gcc warning

Andrew Morgan ziltro at ziltro.com
Thu Jan 21 23:51:26 CET 2010


This patch makes it compile, thanks. :)

Acked-by: Andrew Morgan <ziltro at ziltro.com>

-- 

Andrew.


Michael Karcher wrote:
> recent gcc/glibc combinations warn about ignoring the fgets() result.
> The problem exists on Ubuntu 9.10 with current updates. This "fix" of
> the non-problem (as I check ferror() afterwards) should even be a
> (negligible) performance optimization.
>
> Signed-off-by: Michael Karcher <flashrom at mkarcher.dialup.fu-berlin.de>
> ---
>  dmi.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/dmi.c b/dmi.c
> index ca75461..d165e9f 100644
> --- a/dmi.c
> +++ b/dmi.c
> @@ -79,8 +79,8 @@ void dmi_init(void)
>  			printf_debug("DMI pipe open error\n");
>  			goto out_free;
>  		}
> -		fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe);
> -		if (ferror(dmidecode_pipe))
> +		if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe) &&
> +		    ferror(dmidecode_pipe))
>  		{
>  			printf_debug("DMI pipe read error\n");
>  			pclose(dmidecode_pipe);
>   





More information about the flashrom mailing list