[systemd-commits] src/udev

Dave Reisner dreisner at kemper.freedesktop.org
Mon Sep 16 08:46:18 PDT 2013


 src/udev/udev-rules.c |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 3cf0f8f7e0b950b5f6d678f3e8b7f0fc0f52d4bf
Author: Dave Reisner <dreisner at archlinux.org>
Date:   Mon Sep 16 11:22:35 2013 -0400

    udev-rules: avoid erroring on trailing whitespace
    
    https://bugs.archlinux.org/task/36950

diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index f14158b..6f8b127 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -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') {



More information about the systemd-commits mailing list