diff options
author | Daniel Mack <github@zonque.org> | 2015-10-20 10:31:38 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-10-20 10:31:38 +0200 |
commit | 824b35c3859bc99b97ac5fa6e09aa34627e9bcd5 (patch) | |
tree | 266c8f9988ba8d1cab00a55b360b3f2e42096dde /src/core | |
parent | ec566e4c7cee67ec2c39475ef08f18a9f1b80efd (diff) | |
parent | 2229f656677f0d50c507aec40cda59f66da5c949 (diff) |
Merge pull request #1568 from poettering/netclass
various fixes, for various things
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/dbus-execute.c | 34 | ||||
-rw-r--r-- | src/core/dbus-unit.c | 2 | ||||
-rw-r--r-- | src/core/load-fragment.c | 1 | ||||
-rw-r--r-- | src/core/manager.c | 4 | ||||
-rw-r--r-- | src/core/service.c | 2 |
5 files changed, 24 insertions, 19 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index b71e5ad300..a286149b53 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -1208,8 +1208,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) @@ -1219,18 +1220,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; @@ -1247,12 +1243,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; } @@ -1260,14 +1256,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; |