chiark / gitweb /
udev: rules - ignore the lack of trailing newline
authorTom Gundersen <teg@jklm.no>
Fri, 28 Nov 2014 20:51:45 +0000 (21:51 +0100)
committerTom Gundersen <teg@jklm.no>
Fri, 28 Nov 2014 20:57:52 +0000 (21:57 +0100)
Also accept '\r' as newline character.

This dropps warnings of the type:

  invalid key/value pair in file /usr/lib/udev/rules.d/40-usb-media-players.rules
  on line 26, starting at character 25 ('')

src/udev/udev-rules.c

index 131abd69f5b46905304a565d323e915d630c7a89..447a86864ea39688a75f9037041fd40a70334915 100644 (file)
@@ -1067,7 +1067,7 @@ static int add_rule(struct udev_rules *rules, char *line,
 
                         /* 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 (!strchr(NEWLINE "\0", *linepos)) {
                                 char buf[2] = {*linepos};
                                 _cleanup_free_ char *tmp;