From 823dc9d9bc1e9aa9e695a9765a8ae54862b913ee Mon Sep 17 00:00:00 2001 From: Michael Karcher Date: Wed, 27 Jan 2010 10:08:33 +0000 Subject: Avoid bogus gcc warning 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. Corresponding to flashrom svn r884. Signed-off-by: Michael Karcher Acked-by: Andrew Morgan --- dmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dmi.c') diff --git a/dmi.c b/dmi.c index ca754610..d165e9f7 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); -- cgit v1.2.3