summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-07-29 18:18:43 -0400
committerDave Reisner <dreisner@archlinux.org>2013-07-29 21:51:58 -0400
commite736cf3582c03273f95bc6f97245b04783fd626b (patch)
tree7d2cc6b817ee5fbe5801789c080359283f84c313
parent7959ff9914a6f3a59dbff95c199bcc540b70ac94 (diff)
udev-rules: report rule parsing errors from get_key
-rw-r--r--src/udev/udev-rules.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 769b670b20..e4facd7bd2 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1066,8 +1066,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) {