]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: skip whitespace after "|" and "!" in the condition parser 12889/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 26 Jun 2019 14:23:18 +0000 (16:23 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 27 Jun 2019 08:54:37 +0000 (10:54 +0200)
We'd skip any whitespace immediately after "=", but then we'd treat whitespace
that is between "|" or "!" and the value as significant. This is rather
confusing, let's ignore it too.

src/core/load-fragment.c

index 8e8f26b636707c5edddb77e601eb28e48bab96ae..d88b9317e91fb427c469142cf150dd19aa2da79a 100644 (file)
@@ -2587,13 +2587,13 @@ int config_parse_unit_condition_string(
                 return 0;
         }
 
-        trigger = rvalue[0] == '|';
+        trigger = *rvalue == '|';
         if (trigger)
-                rvalue++;
+                rvalue += 1 + strspn(rvalue + 1, WHITESPACE);
 
-        negate = rvalue[0] == '!';
+        negate = *rvalue == '!';
         if (negate)
-                rvalue++;
+                rvalue += 1 + strspn(rvalue + 1, WHITESPACE);
 
         r = unit_full_printf(u, rvalue, &s);
         if (r < 0) {