summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--dmi.c16
2 files changed, 6 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index 9361eb2..a89bafa 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
diff --git a/dmi.c b/dmi.c
index 1a59834..270fd82 100644
--- a/dmi.c
+++ b/dmi.c
@@ -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) {