mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-28 20:25:25 +03:00
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
This commit is contained in:
parent
a6a2f018be
commit
7a100dce9d
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user