summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-11-27 15:19:44 +1000
committerAnthony G. Basile <blueness@gentoo.org>2014-12-01 19:40:18 -0500
commited19623f625ae5b1727c0e80a74e3d4da64af00a (patch)
tree3ca4df0a614707959fa1f3a552f95630a711a8db /src/udev
parentc0d8d523a6a607c1d8a642c2320a191878051045 (diff)
udevadm hwdb: discard extra leading whitespaces in hwdb
Currently a property in the form of FOO=bar is stored as " FOO=bar", i.e. the property name contains a leading space. That's quite hard to spot. This patch discards all extra whitespaces but the first one which is required by libudev's hwdb_add_property. [zj: modify the check a bit] https://bugs.freedesktop.org/show_bug.cgi?id=82311 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udevadm-hwdb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index eededa9b2b..a3f93ba343 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -435,6 +435,10 @@ static int insert_data(struct trie *trie, struct udev_list *match_list,
value[0] = '\0';
value++;
+ /* libudev requires properties to start with a space */
+ while (isblank(line[0]) && isblank(line[1]))
+ line++;
+
if (line[0] == '\0' || value[0] == '\0') {
log_error("Error, empty key or value '%s' in '%s':", line, filename);
return -EINVAL;