summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dbus-execute.c34
-rw-r--r--src/core/dbus-unit.c2
-rw-r--r--src/core/load-fragment.c1
-rw-r--r--src/core/manager.c4
-rw-r--r--src/core/service.c2
5 files changed, 24 insertions, 19 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 98cf0e9ff1..20fefde62e 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -1214,8 +1214,9 @@ int bus_exec_context_set_transient_property(
_cleanup_free_ char *joined = NULL;
_cleanup_fclose_ FILE *f = NULL;
+ _cleanup_free_ char **l = NULL;
size_t size = 0;
- bool empty_array = true;
+ char **i;
r = sd_bus_message_enter_container(message, 'a', "(sb)");
if (r < 0)
@@ -1225,18 +1226,13 @@ int bus_exec_context_set_transient_property(
if (!f)
return -ENOMEM;
- if (mode != UNIT_CHECK) {
- char **buf;
- STRV_FOREACH(buf, c->environment_files)
- fprintf(f, "EnvironmentFile=%s\n", *buf);
- }
+ STRV_FOREACH(i, c->environment_files)
+ fprintf(f, "EnvironmentFile=%s\n", *i);
while ((r = sd_bus_message_enter_container(message, 'r', "sb")) > 0) {
const char *path;
int b;
- empty_array = false;
-
r = sd_bus_message_read(message, "sb", &path, &b);
if (r < 0)
return r;
@@ -1253,12 +1249,12 @@ int bus_exec_context_set_transient_property(
char *buf = NULL;
buf = strjoin(b ? "-" : "", path, NULL);
- if (buf == NULL)
+ if (!buf)
return -ENOMEM;
fprintf(f, "EnvironmentFile=%s\n", buf);
- r = strv_consume(&c->environment_files, buf);
+ r = strv_consume(&l, buf);
if (r < 0)
return r;
}
@@ -1266,14 +1262,22 @@ int bus_exec_context_set_transient_property(
if (r < 0)
return r;
- fflush(f);
+ r = fflush_and_check(f);
+ if (r < 0)
+ return r;
- if (mode != UNIT_CHECK)
- if (empty_array) {
- strv_clear(c->environment_files);
+ if (mode != UNIT_CHECK) {
+ if (strv_isempty(l)) {
+ c->environment_files = strv_free(c->environment_files);
unit_write_drop_in_private(u, mode, name, "EnvironmentFile=\n");
- } else
+ } else {
+ r = strv_extend_strv(&c->environment_files, l, true);
+ if (r < 0)
+ return r;
+
unit_write_drop_in_private(u, mode, name, joined);
+ }
+ }
r = sd_bus_message_exit_container(message);
if (r < 0)
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index cd88a87340..52daf11610 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -679,7 +679,7 @@ const sd_bus_vtable bus_unit_vtable[] = {
SD_BUS_PROPERTY("Asserts", "a(sbbsi)", property_get_conditions, offsetof(Unit, asserts), 0),
SD_BUS_PROPERTY("LoadError", "(ss)", property_get_load_error, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("Transient", "b", bus_property_get_bool, offsetof(Unit, transient), SD_BUS_VTABLE_PROPERTY_CONST),
- SD_BUS_PROPERTY("NetClass", "u", bus_property_get_unsigned, offsetof(Unit, cgroup_netclass_id), 0),
+ SD_BUS_PROPERTY("NetClass", "u", NULL, offsetof(Unit, cgroup_netclass_id), 0),
SD_BUS_METHOD("Start", "s", "o", method_start, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("Stop", "s", "o", method_stop, SD_BUS_VTABLE_UNPRIVILEGED),
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index b1d4c6b57d..ba39df6877 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2742,6 +2742,7 @@ int config_parse_tasks_max(
return 0;
}
+ c->tasks_max = u;
return 0;
}
diff --git a/src/core/manager.c b/src/core/manager.c
index b2d56e88a7..6ae836148d 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2952,9 +2952,9 @@ void manager_set_show_status(Manager *m, ShowStatus mode) {
m->show_status = mode;
if (mode > 0)
- touch("/run/systemd/show-status");
+ (void) touch("/run/systemd/show-status");
else
- unlink("/run/systemd/show-status");
+ (void) unlink("/run/systemd/show-status");
}
static bool manager_get_show_status(Manager *m, StatusType type) {
diff --git a/src/core/service.c b/src/core/service.c
index 1e4f707bf4..c77d4dc796 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1215,7 +1215,7 @@ static int service_spawn(
if (is_control && UNIT(s)->cgroup_path) {
path = strjoina(UNIT(s)->cgroup_path, "/control");
- cg_create(SYSTEMD_CGROUP_CONTROLLER, path);
+ (void) cg_create(SYSTEMD_CGROUP_CONTROLLER, path);
} else
path = UNIT(s)->cgroup_path;