summaryrefslogtreecommitdiffstats
path: root/dmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'dmi.c')
-rw-r--r--dmi.c16
1 files changed, 4 insertions, 12 deletions
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) {