diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | dmioem.c | 12 |
2 files changed, 12 insertions, 1 deletions
@@ -5,6 +5,7 @@ unsigned integers. * util.c: Fix warnings about unused labels when building without -DUSE_MMAP. + * dmioem.c: Strip spaces at the end of vendor names. 2015-05-12 Jean Delvare <jdelvare@suse.de> @@ -41,7 +41,17 @@ static enum DMI_VENDORS dmi_vendor = VENDOR_UNKNOWN; */ void dmi_set_vendor(const char *s) { - if (strcmp(s, "HP") == 0 || strcmp(s, "Hewlett-Packard") == 0) + int len; + + /* + * Often DMI strings have trailing spaces. Ignore these + * when checking for known vendor names. + */ + len = strlen(s); + while (len && s[len - 1] == ' ') + len--; + + if (strncmp(s, "HP", len) == 0 || strncmp(s, "Hewlett-Packard", len) == 0) dmi_vendor = VENDOR_HP; } |