diff options
author | Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de> | 2010-03-24 17:55:04 +0000 |
---|---|---|
committer | Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de> | 2010-03-24 17:55:04 +0000 |
commit | 45f79cb279d4f00f1c0be33e101ffc2c1c1fdf8d (patch) | |
tree | ad981b19c17a753cfc93dccfb65339c53698568b | |
parent | 69e5811e791dce0bb03796d842314c0397ff0e7c (diff) | |
download | flashrom-45f79cb279d4f00f1c0be33e101ffc2c1c1fdf8d.tar.gz flashrom-45f79cb279d4f00f1c0be33e101ffc2c1c1fdf8d.tar.bz2 flashrom-45f79cb279d4f00f1c0be33e101ffc2c1c1fdf8d.zip |
Fix handling of empty dmidecode output
Corresponding to flashrom svn r973.
Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
-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. */ |