]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/conf-parser: be nice and ignore lines without "="
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 18 Jul 2019 09:28:55 +0000 (11:28 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 18 Jul 2019 09:39:25 +0000 (11:39 +0200)
We generally don't treat syntax error as fatal, but in this case we would
completely refuse to load the file. I think we should treat the the same
as assignment outside of a section, or an unknown key name.

src/shared/conf-parser.c

index 62fc1c97b71ee900b02208f8585b3d552a9e349c..c3af23087031d01d0de9ca66d1c4fbe1144f496f 100644 (file)
@@ -239,7 +239,6 @@ static int parse_line(
         }
 
         if (sections && !*section) {
-
                 if (!(flags & CONFIG_PARSE_RELAXED) && !*section_ignored)
                         log_syntax(unit, LOG_WARNING, filename, line, 0, "Assignment outside of section. Ignoring.");
 
@@ -247,10 +246,9 @@ static int parse_line(
         }
 
         e = strchr(l, '=');
-        if (!e) {
-                log_syntax(unit, LOG_WARNING, filename, line, 0, "Missing '='.");
-                return -EINVAL;
-        }
+        if (!e)
+                return log_syntax(unit, LOG_WARNING, filename, line, 0,
+                                  "Missing '=', ignoring line.");
 
         *e = 0;
         e++;