Author: mkarcher Date: Wed Mar 24 18:55:04 2010 New Revision: 973 URL: http://flashrom.org/trac/coreboot/changeset/973
Log: Fix handling of empty dmidecode output
Signed-off-by: Michael Karcher flashrom@mkarcher.dialup.fu-berlin.de Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: trunk/dmi.c
Modified: trunk/dmi.c ============================================================================== --- trunk/dmi.c Tue Mar 23 18:10:28 2010 (r972) +++ trunk/dmi.c Wed Mar 24 18:55:04 2010 (r973) @@ -56,11 +56,14 @@ printf_debug("DMI pipe open error\n"); return NULL; } - if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe) && - ferror(dmidecode_pipe)) { - printf_debug("DMI pipe read error\n"); - pclose(dmidecode_pipe); - return NULL; + if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe)) { + if(ferror(dmidecode_pipe)) { + printf_debug("DMI pipe read error\n"); + pclose(dmidecode_pipe); + return NULL; + } else { + answerbuf[0] = 0; /* Hit EOF */ + } } /* Toss all output above DMI_MAX_ANSWER_LEN away to prevent deadlock on pclose. */