From 4b4cb0a1ffbc63c6b40d4205f8e248108217e3dc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 14 Oct 2015 19:31:42 +0200 Subject: core: fix type of NetClass dbus property it's exposed as uint32_t and it is internally an uint32_t, hence no need to treat it as an unsigned. --- src/core/dbus-unit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') 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), -- cgit v1.2.3-54-g00ecf From ac5b0c13d8023745c0fbdaaa95dcec5b7b21d1e2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 14 Oct 2015 19:32:46 +0200 Subject: tree-wide: add more void casts for various syscall invocations --- src/core/manager.c | 4 ++-- src/core/service.c | 2 +- src/journal/journald-server.c | 2 +- src/timesync/timesyncd.c | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/core') 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; diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 2d2a215f5d..62a5a2ad40 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1231,7 +1231,7 @@ static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo * server_sync(s); server_vacuum(s, false, false); - touch("/run/systemd/journal/flushed"); + (void) touch("/run/systemd/journal/flushed"); return 0; } diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c index 3cb7d435cd..722b349b81 100644 --- a/src/timesync/timesyncd.c +++ b/src/timesync/timesyncd.c @@ -57,12 +57,12 @@ static int load_clock_timestamp(uid_t uid, gid_t gid) { /* Try to fix the access mode, so that we can still touch the file after dropping priviliges */ - fchmod(fd, 0644); - fchown(fd, uid, gid); + (void) fchmod(fd, 0644); + (void) fchown(fd, uid, gid); } else /* create stamp file with the compiled-in date */ - touch_file("/var/lib/systemd/clock", true, min, uid, gid, 0644); + (void) touch_file("/var/lib/systemd/clock", true, min, uid, gid, 0644); ct = now(CLOCK_REALTIME); if (ct < min) { @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) { /* if we got an authoritative time, store it in the file system */ if (m->sync) - touch("/var/lib/systemd/clock"); + (void) touch("/var/lib/systemd/clock"); sd_event_get_exit_code(m->event, &r); -- cgit v1.2.3-54-g00ecf From 0245cf8167d34e483955b90da7f5d5f154ca57ef Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 14 Oct 2015 22:41:25 +0200 Subject: core: actually set pids_max field after parsing it Fixes one of the issues pointed out in #1522. --- src/core/load-fragment.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/core') 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; } -- cgit v1.2.3-54-g00ecf From 2229f656677f0d50c507aec40cda59f66da5c949 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 19 Oct 2015 23:43:19 +0200 Subject: dbus-execute: some cleanups when parsing EnvironmentFiles= for transient units --- src/core/dbus-execute.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/core') 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) -- cgit v1.2.3-54-g00ecf