summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--dmioem.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 4bc8461..7236101 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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>
diff --git a/dmioem.c b/dmioem.c
index 4219a10..bbc2fa3 100644
--- a/dmioem.c
+++ b/dmioem.c
@@ -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;
}