Changeset 1136


Ignore:
Timestamp:
08/08/10 23:56:52 (18 months ago)
Author:
mkarcher
Message:

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.

Signed-off-by: Michael Karcher <flashrom@…>
Acked-by: Sean Nelson <audiohacked@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dmi.c

    r1112 r1136  
    7777                return NULL; 
    7878        } 
    79         if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe)) { 
    80                 if(ferror(dmidecode_pipe)) { 
    81                         msg_perr("DMI pipe read error\n"); 
    82                         pclose(dmidecode_pipe); 
    83                         return NULL; 
    84                 } else { 
    85                         answerbuf[0] = 0;       /* Hit EOF */ 
     79 
     80        /* Kill lines starting with '#', as recent dmidecode versions 
     81           have the quirk to emit a "# SMBIOS implementations newer..." 
     82           message even on "-s" if the SMBIOS declares a 
     83           newer-than-supported version number, while it *should* only print 
     84           the requested string. */ 
     85        do { 
     86                if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe)) { 
     87                        if(ferror(dmidecode_pipe)) { 
     88                                msg_perr("DMI pipe read error\n"); 
     89                                pclose(dmidecode_pipe); 
     90                                return NULL; 
     91                        } else { 
     92                                answerbuf[0] = 0;       /* Hit EOF */ 
     93                        } 
    8694                } 
    87         } 
     95        } while(answerbuf[0] == '#'); 
     96 
    8897        /* Toss all output above DMI_MAX_ANSWER_LEN away to prevent 
    8998           deadlock on pclose. */ 
Note: See TracChangeset for help on using the changeset viewer.