From: Zbigniew Jędrzejewski-Szmek Date: Thu, 6 Jul 2017 17:54:42 +0000 (-0400) Subject: core/load-fragment: refuse units with errors in RootDirectory/RootImage/DynamicUser X-Git-Tag: chiark/234.4-1+devuan1.1+iwj1~77 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=ba4526cc887de47a7466eadd3ccf1dd1bf8d5369 core/load-fragment: refuse units with errors in RootDirectory/RootImage/DynamicUser Behaviour of the service is completely different with the option off, so the service would probably mess up state on disk and do unexpected things. --- diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 291c4188c..f2515ab86 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -622,6 +622,7 @@ int config_parse_bool(const char* unit, int k; bool *b = data; + bool fatal = ltype; assert(filename); assert(lvalue); @@ -630,8 +631,10 @@ int config_parse_bool(const char* unit, k = parse_boolean(rvalue); if (k < 0) { - log_syntax(unit, LOG_ERR, filename, line, k, "Failed to parse boolean value, ignoring: %s", rvalue); - return 0; + log_syntax(unit, LOG_ERR, filename, line, k, + "Failed to parse boolean value%s: %s", + fatal ? "" : ", ignoring", rvalue); + return fatal ? -ENOEXEC : 0; } *b = !!k; @@ -724,6 +727,7 @@ int config_parse_path( void *userdata) { char **s = data, *n; + bool fatal = ltype; assert(filename); assert(lvalue); @@ -732,12 +736,14 @@ int config_parse_path( if (!utf8_is_valid(rvalue)) { log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue); - return 0; + return fatal ? -ENOEXEC : 0; } if (!path_is_absolute(rvalue)) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Not an absolute path, ignoring: %s", rvalue); - return 0; + log_syntax(unit, LOG_ERR, filename, line, 0, + "Not an absolute path%s: %s", + fatal ? "" : ", ignoring", rvalue); + return fatal ? -ENOEXEC : 0; } n = strdup(rvalue);