diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/cgroup-util.c | 7 | ||||
-rw-r--r-- | src/core/cgroup.c | 2 | ||||
-rw-r--r-- | src/core/scope.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-creds.c | 6 | ||||
-rw-r--r-- | src/login/logind-dbus.c | 21 | ||||
-rw-r--r-- | src/network/networkd-dhcp4.c | 6 | ||||
-rw-r--r-- | src/network/networkd-manager.c | 6 | ||||
-rw-r--r-- | src/test/test-engine.c | 2 | ||||
-rw-r--r-- | src/test/test-path.c | 2 | ||||
-rw-r--r-- | src/test/test-sched-prio.c | 2 | ||||
-rw-r--r-- | src/udev/udevd.c | 2 |
11 files changed, 32 insertions, 26 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 218de0b376..0ebe570bb8 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -540,10 +540,7 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch else { const char *dn; - if (controller) - dn = controller_to_dirname(controller); - else - dn = NULL; + dn = controller_to_dirname(controller); r = join_path_legacy(dn, path, suffix, fs); } @@ -1913,7 +1910,7 @@ int cg_attach_many_everywhere(CGroupMask supported, const char *path, Set* pids, } int cg_migrate_everywhere(CGroupMask supported, const char *from, const char *to, cg_migrate_callback_t to_callback, void *userdata) { - CGroupController c; + CGroupController c; int r, unified; if (!path_equal(from, to)) { diff --git a/src/core/cgroup.c b/src/core/cgroup.c index a70b4d33ae..1e78f871c7 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -1076,7 +1076,7 @@ int unit_search_main_pid(Unit *u, pid_t *ret) { } static int unit_watch_pids_in_path(Unit *u, const char *path) { - _cleanup_closedir_ DIR *d = NULL; + _cleanup_closedir_ DIR *d = NULL; _cleanup_fclose_ FILE *f = NULL; int ret = 0, r; diff --git a/src/core/scope.c b/src/core/scope.c index 44cd324f58..35cf0621be 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -138,7 +138,7 @@ static int scope_verify(Scope *s) { return 0; if (set_isempty(UNIT(s)->pids) && - !manager_is_reloading_or_reexecuting(UNIT(s)->manager) <= 0 && + !manager_is_reloading_or_reexecuting(UNIT(s)->manager) && !unit_has_name(UNIT(s), SPECIAL_INIT_SCOPE)) { log_unit_error(UNIT(s), "Scope has no PIDs. Refusing."); return -EINVAL; diff --git a/src/libsystemd/sd-bus/test-bus-creds.c b/src/libsystemd/sd-bus/test-bus-creds.c index edd5033db2..580117165a 100644 --- a/src/libsystemd/sd-bus/test-bus-creds.c +++ b/src/libsystemd/sd-bus/test-bus-creds.c @@ -22,11 +22,17 @@ #include "sd-bus.h" #include "bus-dump.h" #include "bus-util.h" +#include "cgroup-util.h" int main(int argc, char *argv[]) { _cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL; int r; + if (cg_unified() == -ENOEXEC) { + puts("Skipping test: /sys/fs/cgroup/ not available"); + return EXIT_TEST_SKIP; + } + r = sd_bus_creds_new_from_pid(&creds, 0, _SD_BUS_CREDS_ALL); assert_se(r >= 0); diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 5b2b36b9c0..7cc68d4865 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1339,8 +1339,7 @@ static int bus_manager_log_shutdown( InhibitWhat w, const char *unit_name) { - const char *p; - const char *q; + const char *p, *q; assert(m); assert(unit_name); @@ -1365,8 +1364,8 @@ static int bus_manager_log_shutdown( q = NULL; } - if (m->wall_message) - p = strjoina(p, " (", m->wall_message, ")", NULL); + if (!isempty(m->wall_message)) + p = strjoina(p, " (", m->wall_message, ")"); return log_struct(LOG_NOTICE, LOG_MESSAGE_ID(SD_MESSAGE_SHUTDOWN), @@ -2294,7 +2293,7 @@ static int method_set_wall_message( int r; Manager *m = userdata; char *wall_message; - bool enable_wall_messages; + int enable_wall_messages; assert(message); assert(m); @@ -2310,15 +2309,19 @@ static int method_set_wall_message( UID_INVALID, &m->polkit_registry, error); - if (r < 0) return r; if (r == 0) return 1; /* Will call us back */ - r = free_and_strdup(&m->wall_message, wall_message); - if (r < 0) - return log_oom(); + if (isempty(wall_message)) + m->wall_message = mfree(m->wall_message); + else { + r = free_and_strdup(&m->wall_message, wall_message); + if (r < 0) + return log_oom(); + } + m->enable_wall_messages = enable_wall_messages; return sd_bus_reply_method_return(message, NULL); diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 36601367bf..4ffb01382f 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -60,7 +60,7 @@ static int link_set_dhcp_routes(Link *link) { assert(link->dhcp_lease); r = sd_dhcp_lease_get_router(link->dhcp_lease, &gateway); - if (r < 0 && r != -ENOENT) + if (r < 0 && r != -ENODATA) return log_link_warning_errno(link, r, "DHCP error: could not get gateway: %m"); if (r >= 0) { @@ -112,7 +112,7 @@ static int link_set_dhcp_routes(Link *link) { } n = sd_dhcp_lease_get_routes(link->dhcp_lease, &static_routes); - if (n == -ENOENT) + if (n == -ENODATA) return 0; if (n < 0) return log_link_warning_errno(link, n, "DHCP error: could not get routes: %m"); @@ -378,7 +378,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) { prefixlen = in_addr_netmask_to_prefixlen(&netmask); r = sd_dhcp_lease_get_router(lease, &gateway); - if (r < 0 && r != -ENOENT) + if (r < 0 && r != -ENODATA) return log_link_error_errno(link, r, "DHCP error: Could not get gateway: %m"); if (r >= 0) diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 16f732f244..92b607297d 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -757,7 +757,7 @@ int manager_save(Manager *m) { r = set_put_in_addrv(dns, addresses, r); if (r < 0) return r; - } else if (r < 0 && r != -ENOENT) + } else if (r < 0 && r != -ENODATA) return r; } @@ -769,7 +769,7 @@ int manager_save(Manager *m) { r = set_put_in_addrv(ntp, addresses, r); if (r < 0) return r; - } else if (r < 0 && r != -ENOENT) + } else if (r < 0 && r != -ENODATA) return r; } @@ -781,7 +781,7 @@ int manager_save(Manager *m) { r = set_put_strdup(domains, domainname); if (r < 0) return r; - } else if (r != -ENOENT) + } else if (r != -ENODATA) return r; } } diff --git a/src/test/test-engine.c b/src/test/test-engine.c index a7ab21a415..6596069ade 100644 --- a/src/test/test-engine.c +++ b/src/test/test-engine.c @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) { /* prepare the test */ assert_se(set_unit_path(TEST_DIR) >= 0); r = manager_new(MANAGER_USER, true, &m); - if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) { + if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT, -ENOEXEC)) { printf("Skipping test: manager_new: %s", strerror(-r)); return EXIT_TEST_SKIP; } diff --git a/src/test/test-path.c b/src/test/test-path.c index 5d190378f1..676c9f1793 100644 --- a/src/test/test-path.c +++ b/src/test/test-path.c @@ -40,7 +40,7 @@ static int setup_test(Manager **m) { assert_se(m); r = manager_new(MANAGER_USER, true, &tmp); - if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) { + if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT, -ENOEXEC)) { printf("Skipping test: manager_new: %s", strerror(-r)); return -EXIT_TEST_SKIP; } diff --git a/src/test/test-sched-prio.c b/src/test/test-sched-prio.c index f915539e00..ebc9110c4d 100644 --- a/src/test/test-sched-prio.c +++ b/src/test/test-sched-prio.c @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) { /* prepare the test */ assert_se(set_unit_path(TEST_DIR) >= 0); r = manager_new(MANAGER_USER, true, &m); - if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) { + if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT, -ENOEXEC)) { printf("Skipping test: manager_new: %s", strerror(-r)); return EXIT_TEST_SKIP; } diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 28ac44fb8e..f354ced2e2 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1706,7 +1706,7 @@ int main(int argc, char *argv[]) { by PID1. otherwise we are not guaranteed to have a dedicated cgroup */ r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 0, &cgroup); if (r < 0) { - if (r == -ENOENT) + if (r == -ENOENT || r == -ENOEXEC) log_debug_errno(r, "did not find dedicated cgroup: %m"); else log_warning_errno(r, "failed to get cgroup: %m"); |