mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
Add dmidecode quirk workaround
Dmidecode emits a warning message about unsupported SMBIOS versions to stdout before the information asked for when using "-s". I consider this behaviour broken, but we still need to workaround it as e.g. Fedora currently distributes an dmidecode with this behaviour. Corresponding to flashrom svn r1136. Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de> Acked-by: Sean Nelson <audiohacked@gmail.com>
This commit is contained in:
parent
243ec63305
commit
d9f266d1fb
25
dmi.c
25
dmi.c
@ -76,15 +76,24 @@ static char *get_dmi_string(const char *string_name)
|
|||||||
msg_perr("DMI pipe open error\n");
|
msg_perr("DMI pipe open error\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe)) {
|
|
||||||
if(ferror(dmidecode_pipe)) {
|
/* Kill lines starting with '#', as recent dmidecode versions
|
||||||
msg_perr("DMI pipe read error\n");
|
have the quirk to emit a "# SMBIOS implementations newer..."
|
||||||
pclose(dmidecode_pipe);
|
message even on "-s" if the SMBIOS declares a
|
||||||
return NULL;
|
newer-than-supported version number, while it *should* only print
|
||||||
} else {
|
the requested string. */
|
||||||
answerbuf[0] = 0; /* Hit EOF */
|
do {
|
||||||
|
if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe)) {
|
||||||
|
if(ferror(dmidecode_pipe)) {
|
||||||
|
msg_perr("DMI pipe read error\n");
|
||||||
|
pclose(dmidecode_pipe);
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
answerbuf[0] = 0; /* Hit EOF */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} while(answerbuf[0] == '#');
|
||||||
|
|
||||||
/* Toss all output above DMI_MAX_ANSWER_LEN away to prevent
|
/* Toss all output above DMI_MAX_ANSWER_LEN away to prevent
|
||||||
deadlock on pclose. */
|
deadlock on pclose. */
|
||||||
while (!feof(dmidecode_pipe))
|
while (!feof(dmidecode_pipe))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user