From: Yu Watanabe Date: Fri, 4 Jun 2021 17:30:17 +0000 (+0900) Subject: conf-parser: make config_parse_tristate() accept an empty string X-Git-Tag: v249-rc1~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=33f2de7b6487c7fe7f45fd9d8fc73cd98e0a53ac;p=thirdparty%2Fsystemd.git conf-parser: make config_parse_tristate() accept an empty string Fixes #19822. --- diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index ce3af649621..d0ac1b26601 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -706,13 +706,18 @@ int config_parse_tristate( assert(rvalue); assert(data); - /* A tristate is pretty much a boolean, except that it can - * also take the special value -1, indicating "uninitialized", - * much like NULL is for a pointer type. */ + /* A tristate is pretty much a boolean, except that it can also take an empty string, + * indicating "uninitialized", much like NULL is for a pointer type. */ + + if (isempty(rvalue)) { + *t = -1; + return 0; + } k = parse_boolean(rvalue); if (k < 0) { - log_syntax(unit, LOG_WARNING, filename, line, k, "Failed to parse boolean value, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, k, + "Failed to parse boolean value for %s=, ignoring: %s", lvalue, rvalue); return 0; }