summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-08-15 20:01:19 -0400
committerAnthony G. Basile <blueness@gentoo.org>2013-09-10 06:11:20 -0400
commita5900164d568d09d1a9e88e5b6a2951779e71e9e (patch)
tree6dc592083f2bae6a7388790c46a114f8834c89da /src/udev
parentb8a7ab71ed69cac6cea61f65987b1ce9465e53c2 (diff)
udev: when complaining about invalid characters, print them out
systemd-udevd[6260]: invalid key/value pair in file /usr/lib/udev/rules.d/60-ffado.rules on line 46,starting at character 84 ('#')
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-rules.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 2c28ef7e20..b421e42363 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -34,6 +34,7 @@
#include "conf-files.h"
#include "strbuf.h"
#include "strv.h"
+#include "util.h"
#define PREALLOC_TOKEN 2048
@@ -1069,10 +1070,17 @@ static int add_rule(struct udev_rules *rules, char *line,
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')
+ if (*linepos != '\n') {
+ char buf[2] = {linepos[1]};
+ _cleanup_free_ char *tmp;
+
+ tmp = cescape(buf);
log_error("invalid key/value pair in file %s on line %u,"
- "starting at character %lu\n",
- filename, lineno, linepos - line + 1);
+ "starting at character %lu ('%s')\n",
+ filename, lineno, linepos - line + 1, tmp);
+ if (linepos[1] == '#')
+ log_info("hint: comments can only start at beginning of line");
+ }
break;
}