diff options
author | Dave Reisner <dreisner@archlinux.org> | 2013-07-29 18:18:43 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2013-07-30 13:50:13 -0400 |
commit | 67ba217a190ec3946ae80d99d02648daf32d826d (patch) | |
tree | 8d86ea2f558b110308970b0adffa1f6db57029b3 /src/udev/udev-rules.c | |
parent | 38382ffbd6bca77680042f967fa8fc5a560fae07 (diff) |
udev-rules: report rule parsing errors from get_key
Diffstat (limited to 'src/udev/udev-rules.c')
-rw-r--r-- | src/udev/udev-rules.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index e947f317c9..399276c567 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1065,8 +1065,15 @@ static int add_rule(struct udev_rules *rules, char *line, char *value; enum operation_type op; - if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) + if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) { + /* If we aren't at the end of the line, this is a parsing error. + * Make a best effort to describe where the problem is. */ + if (*linepos != '\n') + log_error("invalid key/value pair in file %s on line %u," + "starting at character %lu\n", + filename, lineno, linepos - line + 1); break; + } if (streq(key, "ACTION")) { if (op > OP_MATCH_MAX) { |