mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
dbus-execute: lets use exec_directory_type_from_string() to simplify things
This commit is contained in:
parent
0f4b93c4b5
commit
b1ea85dc08
@ -2185,24 +2185,19 @@ int bus_exec_context_set_transient_property(
|
||||
}
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
char ***dirs = NULL;
|
||||
ExecDirectoryType i;
|
||||
ExecDirectory *d;
|
||||
|
||||
for (i = 0; i < _EXEC_DIRECTORY_TYPE_MAX; i++)
|
||||
if (streq(name, exec_directory_type_to_string(i))) {
|
||||
dirs = &c->directories[i].paths;
|
||||
break;
|
||||
}
|
||||
|
||||
assert(dirs);
|
||||
assert_se((i = exec_directory_type_from_string(name)) >= 0);
|
||||
d = c->directories + i;
|
||||
|
||||
if (strv_isempty(l)) {
|
||||
*dirs = strv_free(*dirs);
|
||||
d->paths = strv_free(d->paths);
|
||||
unit_write_settingf(u, flags, name, "%s=", name);
|
||||
} else {
|
||||
_cleanup_free_ char *joined = NULL;
|
||||
|
||||
r = strv_extend_strv(dirs, l, true);
|
||||
r = strv_extend_strv(&d->paths, l, true);
|
||||
if (r < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user