[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH] dmioem: Strip spaces at the end of vendor names
From: |
Jean Delvare |
Subject: |
[dmidecode] [PATCH] dmioem: Strip spaces at the end of vendor names |
Date: |
Wed, 29 Apr 2015 16:01:59 +0200 |
Often DMI strings have trailing spaces. Ignore these when checking for
known vendor names.
---
dmioem.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
--- dmidecode.orig/dmioem.c 2015-04-29 15:09:35.515873759 +0200
+++ dmidecode/dmioem.c 2015-04-29 15:40:56.161617300 +0200
@@ -41,7 +41,17 @@ static enum DMI_VENDORS dmi_vendor = VEN
*/
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;
}
--
Jean Delvare
SUSE L3 Support
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dmidecode] [PATCH] dmioem: Strip spaces at the end of vendor names,
Jean Delvare <=