diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-11-27 15:19:44 +1000 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-11-28 14:30:50 -0500 |
commit | 36afca67b67984520c5c9a6ce14af51a68c7c8cf (patch) | |
tree | 3c24204b654ef45cd18a6703d3b766819e077a8d /src/udev/udevadm-hwdb.c | |
parent | e6a7b9f45553fe0f73ba1f6134f4829b1d519658 (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
Diffstat (limited to 'src/udev/udevadm-hwdb.c')
-rw-r--r-- | src/udev/udevadm-hwdb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index fa137c1cc2..a5870d1cee 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -428,6 +428,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; |