diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2014-12-07 10:46:02 +0100 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2014-12-07 10:46:02 +0100 |
commit | 58a0fe838e973dd0c3cc102f07af9bb2f5ec9075 (patch) | |
tree | 532476a2a5fb023d20b4a40131d14e3cfecc5266 | |
parent | 0e5d5037b3a5c78b218a69129ee6b90bf5757e0f (diff) | |
download | ldetect-58a0fe838e973dd0c3cc102f07af9bb2f5ec9075.tar ldetect-58a0fe838e973dd0c3cc102f07af9bb2f5ec9075.tar.gz ldetect-58a0fe838e973dd0c3cc102f07af9bb2f5ec9075.tar.bz2 ldetect-58a0fe838e973dd0c3cc102f07af9bb2f5ec9075.tar.xz ldetect-58a0fe838e973dd0c3cc102f07af9bb2f5ec9075.zip |
drop support for dmidecode < 2.7
(which we have since January 2006, mdv2007.0...)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | dmi.c | 16 |
2 files changed, 6 insertions, 12 deletions
@@ -1,3 +1,5 @@ +- drop support for dmidecode < 2.7 + Version 0.12.7 - 5 April 2013, Thierry Vignaud - do not fake Xen blk & net controllers on dom0 (mga#9546) @@ -120,19 +120,11 @@ static struct criteria criteria_from_dmidecode(void) { const struct category *category = NULL; - /* dmidecode output is less indented as of 2.7 */ - int tab_level = 1; - if (fgets(buf, sizeof(buf) - 1, f)) { - int major, minor; - if (sscanf(buf, "# dmidecode %d.%d", &major, &minor) == 2 && major >= 2 && minor >= 7) - tab_level = 0; - } - while (fgets(buf, sizeof(buf) - 1, f)) { - if (!buf[0] || !buf[1] || (tab_level && buf[0] != '\t')) + if (!buf[0] || !buf[1]) ; /* don't care */ - else if (buf[tab_level] != '\t') { - char *s = buf + tab_level; + else if (buf[0] != '\t') { + char *s = buf; if (!str_begins_with(s, "DMI type ")) { remove_ending_spaces(s); remove_suffix_in_place(s, " Information"); @@ -140,7 +132,7 @@ static struct criteria criteria_from_dmidecode(void) { } } else if (category) { /* don't even look if we don't have an interesting category */ - char *s = buf + tab_level + 1; + char *s = buf + 1; char *val = get_after_colon(s); if (val && lookup_field(category, s)) { if (r.nb >= allocated) { |