summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-09-16 11:22:35 -0400
committerAnthony G. Basile <blueness@gentoo.org>2014-01-09 18:45:19 -0500
commit86c525451163f8f3cef927e9c74b94892e053b7a (patch)
treec65d62328f8e5f1399096cfb1410525c5cc1973e
parent819e122c907e1f9f07b209bbbfb207d27bf76914 (diff)
udev-rules: avoid erroring on trailing whitespace
https://bugs.archlinux.org/task/36950 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r--src/udev/udev-rules.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 15839b6f58..962102ebe7 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') {