diff options
author | mkarcher <mkarcher@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2010-03-24 17:55:04 +0000 |
---|---|---|
committer | mkarcher <mkarcher@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2010-03-24 17:55:04 +0000 |
commit | 6fb4a43c3e858355918ff837346392f31baac575 (patch) | |
tree | ad981b19c17a753cfc93dccfb65339c53698568b /dmi.c | |
parent | 115b2790f59e41fb84eac32df3b9c31aebe8cc55 (diff) | |
download | flashrom-6fb4a43c3e858355918ff837346392f31baac575.tar.gz |
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>
git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@973 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'dmi.c')
-rw-r--r-- | dmi.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -56,11 +56,14 @@ static char *get_dmi_string(const char *string_name) 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. */ |