chiark / gitweb /
support acpi firmware performance data (FPDT)
[elogind.git] / src / udev / udev-rules.c
index 16348126ee6e88140cec2b48709c8614954cbfa6..6f8b1278723afd30335ad6422a9aa65a357a9e32 100644 (file)
@@ -1068,6 +1068,12 @@ static int add_rule(struct udev_rules *rules, char *line,
                 enum operation_type op;
 
                 if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) {
+                        /* Avoid erroring on trailing whitespace. This is probably rare
+                         * so save the work for the error case instead of always trying
+                         * to strip the trailing whitespace with strstrip(). */
+                        while (isblank(*linepos))
+                                linepos++;
+
                         /* 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') {
@@ -1076,7 +1082,7 @@ static int add_rule(struct udev_rules *rules, char *line,
 
                                 tmp = cescape(buf);
                                 log_error("invalid key/value pair in file %s on line %u,"
-                                          "starting at character %lu ('%s')\n",
+                                          "starting at character %tu ('%s')\n",
                                           filename, lineno, linepos - line + 1, tmp);
                                 if (linepos[1] == '#')
                                         log_info("hint: comments can only start at beginning of line");