diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-12-01 11:46:40 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-12-11 18:01:26 -0500 |
commit | 7a100dce9db33006888156876ff8aeb27e77eed2 (patch) | |
tree | 4ebdbe410e396a75dba6e0cc15b25537ec2533d6 /src/hwdb/hwdb.c | |
parent | a6a2f018bec9087427ba202691db7b663cce932c (diff) | |
download | systemd-7a100dce9db33006888156876ff8aeb27e77eed2.tar.gz systemd-7a100dce9db33006888156876ff8aeb27e77eed2.tar.bz2 systemd-7a100dce9db33006888156876ff8aeb27e77eed2.zip |
hwdb: emit warning when matches are specified at the very end of file
This is also an error, but it wasn't caught.
[/tmp/tmp.YWeKax4fMI/etc/udev/hwdb.d/10-bad.hwdb:26] Property expected, ignoring record with no properties
Diffstat (limited to 'src/hwdb/hwdb.c')
-rw-r--r-- | src/hwdb/hwdb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c index d2fe75fc79..a23b614791 100644 --- a/src/hwdb/hwdb.c +++ b/src/hwdb/hwdb.c @@ -554,8 +554,8 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr break; } - /* another match */ if (line[0] != ' ') { + /* another match */ match = strdup(line); if (!match) return -ENOMEM; @@ -573,8 +573,8 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr break; case HW_DATA: - /* end of record */ if (len == 0) { + /* end of record */ state = HW_NONE; strv_clear(match_list); break; @@ -593,6 +593,10 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr }; } + if (state == HW_MATCH) + log_syntax(NULL, LOG_WARNING, filename, line_number, EINVAL, + "Property expected, ignoring record with no properties"); + return 0; } |