mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
conf-parser: when we parse a string list, always fill in something
Some code really wants to know whether there was a string list parsed, so don't take the shortcut here, and always allocate a string list, even if it is an empty one. https://bugs.freedesktop.org/show_bug.cgi?id=62558
This commit is contained in:
parent
54b1da83ed
commit
4589f5bb0a
@ -705,9 +705,18 @@ int config_parse_strv(
|
||||
assert(data);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
/* Empty assignment resets the list */
|
||||
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 = strv_new(NULL, NULL);
|
||||
if (!empty)
|
||||
return log_oom();
|
||||
|
||||
strv_free(*sv);
|
||||
*sv = NULL;
|
||||
*sv = empty;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user