summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-09-14 16:53:34 +0200
committerSven Eden <yamakuzure@gmx.net>2017-09-14 16:53:34 +0200
commitb40e4e606d3002188014f43b9eeb937baf41820e (patch)
tree541d6db5d4c5e749f4b1f35e9a44327cf89bddd9
parent748d5da36ddd9229a87872687ad07d56d9bdcc10 (diff)
core: don't synthesize empty list when empty string is read in config_parse_strv()
This was added to make https://bugs.freedesktop.org/show_bug.cgi?id=62558 work, which has long been removed, hence let's revert to the original behaviour and fully flush out the list when an empty string is assigned.
-rw-r--r--src/shared/conf-parser.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 2437c1ca7..b213b0fa5 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -758,16 +758,17 @@ int config_parse_path(
return 0;
}
-int config_parse_strv(const char *unit,
- const char *filename,
- unsigned line,
- const char *section,
- unsigned section_line,
- const char *lvalue,
- int ltype,
- const char *rvalue,
- void *data,
- void *userdata) {
+int config_parse_strv(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
char ***sv = data;
int r;
@@ -778,19 +779,7 @@ int config_parse_strv(const char *unit,
assert(data);
if (isempty(rvalue)) {
- char **empty;
-
- /* Empty assignment resets the list. As a special rule
- * we actually fill in a real empty array here rather
- * than NULL, since some code wants to know if
- * something was set at all... */
- empty = new0(char*, 1);
- if (!empty)
- return log_oom();
-
- strv_free(*sv);
- *sv = empty;
-
+ *sv = strv_free(*sv);
return 0;
}
@@ -812,6 +801,7 @@ int config_parse_strv(const char *unit,
free(word);
continue;
}
+
r = strv_consume(sv, word);
if (r < 0)
return log_oom();