From 27217200f6569f5ed7dae9c9e7d7251d41a26249 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 25 Nov 2025 13:03:18 +0100 Subject: [PATCH] core: Rename error sd_bus_error parameters to reterr_error --- src/core/dbus-automount.c | 14 +- src/core/dbus-automount.h | 7 +- src/core/dbus-cgroup.c | 182 +++++------ src/core/dbus-cgroup.h | 26 +- src/core/dbus-execute.c | 384 +++++++++++----------- src/core/dbus-execute.h | 71 ++++- src/core/dbus-job.c | 14 +- src/core/dbus-job.h | 4 +- src/core/dbus-kill.c | 18 +- src/core/dbus-kill.h | 8 +- src/core/dbus-manager.c | 654 +++++++++++++++++++------------------- src/core/dbus-manager.h | 27 +- src/core/dbus-mount.c | 38 +-- src/core/dbus-mount.h | 7 +- src/core/dbus-path.c | 22 +- src/core/dbus-path.h | 7 +- src/core/dbus-scope.c | 38 +-- src/core/dbus-scope.h | 9 +- src/core/dbus-service.c | 142 ++++----- src/core/dbus-service.h | 13 +- src/core/dbus-slice.c | 14 +- src/core/dbus-slice.h | 2 +- src/core/dbus-socket.c | 136 ++++---- src/core/dbus-socket.h | 2 +- src/core/dbus-swap.c | 4 +- src/core/dbus-swap.h | 2 +- src/core/dbus-timer.c | 54 ++-- src/core/dbus-timer.h | 7 +- src/core/dbus-unit.c | 380 +++++++++++----------- src/core/dbus-unit.h | 38 +-- src/core/dbus-util.c | 54 ++-- src/core/dbus-util.h | 73 +++-- src/core/dbus.c | 42 +-- src/core/manager.c | 18 +- src/core/manager.h | 4 +- src/core/selinux-access.c | 24 +- src/core/selinux-access.h | 13 +- src/core/service.c | 18 +- src/core/unit.c | 44 +-- src/core/unit.h | 19 +- src/core/varlink-unit.c | 2 +- 41 files changed, 1394 insertions(+), 1241 deletions(-) diff --git a/src/core/dbus-automount.c b/src/core/dbus-automount.c index 881bf50b6ee..cdab84a8e55 100644 --- a/src/core/dbus-automount.c +++ b/src/core/dbus-automount.c @@ -23,7 +23,7 @@ static int bus_automount_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = UNIT(a); @@ -34,16 +34,16 @@ static int bus_automount_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "Where")) - return bus_set_transient_path(u, name, &a->where, message, flags, error); + return bus_set_transient_path(u, name, &a->where, message, flags, reterr_error); if (streq(name, "ExtraOptions")) - return bus_set_transient_string(u, name, &a->extra_options, message, flags, error); + return bus_set_transient_string(u, name, &a->extra_options, message, flags, reterr_error); if (streq(name, "TimeoutIdleUSec")) - return bus_set_transient_usec_fix_0(u, name, &a->timeout_idle_usec, message, flags, error); + return bus_set_transient_usec_fix_0(u, name, &a->timeout_idle_usec, message, flags, reterr_error); if (streq(name, "DirectoryMode")) - return bus_set_transient_mode_t(u, name, &a->directory_mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &a->directory_mode, message, flags, reterr_error); return 0; } @@ -53,7 +53,7 @@ int bus_automount_set_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Automount *a = AUTOMOUNT(u); @@ -62,7 +62,7 @@ int bus_automount_set_property( assert(message); if (u->transient && u->load_state == UNIT_STUB) /* This is a transient unit? let's load a little more */ - return bus_automount_set_transient_property(a, name, message, flags, error); + return bus_automount_set_transient_property(a, name, message, flags, reterr_error); return 0; } diff --git a/src/core/dbus-automount.h b/src/core/dbus-automount.h index 6e46d9b2779..ee59dc94496 100644 --- a/src/core/dbus-automount.h +++ b/src/core/dbus-automount.h @@ -7,4 +7,9 @@ extern const sd_bus_vtable bus_automount_vtable[]; -int bus_automount_set_property(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); +int bus_automount_set_property( + Unit *u, + const char *name, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c index 82e2a9f9618..156207c3219 100644 --- a/src/core/dbus-cgroup.c +++ b/src/core/dbus-cgroup.c @@ -38,7 +38,7 @@ static int property_get_cgroup_mask( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupMask *mask = userdata; int r; @@ -69,7 +69,7 @@ static int property_get_delegate_controllers( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupContext *c = ASSERT_PTR(userdata); @@ -79,7 +79,7 @@ static int property_get_delegate_controllers( if (!c->delegate) return sd_bus_message_append(reply, "as", 0); - return property_get_cgroup_mask(bus, path, interface, property, reply, &c->delegate_controllers, error); + return property_get_cgroup_mask(bus, path, interface, property, reply, &c->delegate_controllers, reterr_error); } static int property_get_cpuset( @@ -89,7 +89,7 @@ static int property_get_cpuset( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CPUSet *cpus = ASSERT_PTR(userdata); _cleanup_free_ uint8_t *array = NULL; @@ -109,7 +109,7 @@ static int property_get_io_device_weight( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupContext *c = ASSERT_PTR(userdata); int r; @@ -137,7 +137,7 @@ static int property_get_io_device_limits( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupContext *c = ASSERT_PTR(userdata); int r; @@ -171,7 +171,7 @@ static int property_get_io_device_latency( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupContext *c = ASSERT_PTR(userdata); int r; @@ -199,7 +199,7 @@ static int property_get_device_allow( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupContext *c = ASSERT_PTR(userdata); int r; @@ -227,7 +227,7 @@ static int property_get_ip_address_access( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Set **prefixes = ASSERT_PTR(userdata); struct in_addr_prefix *i; @@ -270,7 +270,7 @@ static int property_get_bpf_foreign_program( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupContext *c = userdata; int r; @@ -296,7 +296,7 @@ static int property_get_socket_bind( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupSocketBindItem **items = ASSERT_PTR(userdata); int r; @@ -321,7 +321,7 @@ static int property_get_restrict_network_interfaces( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupContext *c = ASSERT_PTR(userdata); int r; @@ -351,7 +351,7 @@ static int property_get_cgroup_nft_set( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { int r; CGroupContext *c = userdata; @@ -456,7 +456,7 @@ static int bus_cgroup_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { int r; @@ -471,7 +471,7 @@ static int bus_cgroup_set_transient_property( int b; if (!UNIT_VTABLE(u)->can_delegate) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type"); r = sd_bus_message_read(message, "b", &b); if (r < 0) @@ -490,14 +490,14 @@ static int bus_cgroup_set_transient_property( const char *s; if (!UNIT_VTABLE(u)->can_delegate) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type"); r = sd_bus_message_read(message, "s", &s); if (r < 0) return r; if (!isempty(s) && cg_needs_escape(s)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid control group name: %s", s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid control group name: %s", s); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { if (isempty(s)) @@ -517,7 +517,7 @@ static int bus_cgroup_set_transient_property( CGroupMask mask = 0; if (streq(name, "DelegateControllers") && !UNIT_VTABLE(u)->can_delegate) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type"); r = sd_bus_message_enter_container(message, 'a', "s"); if (r < 0) @@ -535,7 +535,7 @@ static int bus_cgroup_set_transient_property( cc = cgroup_controller_from_string(t); if (cc < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown cgroup controller '%s'", t); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unknown cgroup controller '%s'", t); mask |= CGROUP_CONTROLLER_TO_MASK(cc); } @@ -592,7 +592,7 @@ static int bus_cgroup_set_transient_property( break; if (!path_is_normalized(path) || !path_is_absolute(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects a normalized absolute path.", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects a normalized absolute path.", name); if (!UNIT_WRITE_FLAGS_NOOP(flags) && !strv_contains(*filters, path)) { r = strv_extend(filters, path); @@ -654,14 +654,14 @@ static int bus_cgroup_set_transient_property( int attach_type = bpf_cgroup_attach_type_from_string(a); if (attach_type < 0) return sd_bus_error_setf( - error, + reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s expects a valid BPF attach type, got '%s'.", name, a); if (!path_is_normalized(p) || !path_is_absolute(p)) return sd_bus_error_setf( - error, + reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects a normalized absolute path.", name); @@ -754,7 +754,7 @@ static int bus_cgroup_set_transient_property( int b; if (!UNIT_VTABLE(u)->can_delegate) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type"); r = sd_bus_message_read(message, "b", &b); if (r < 0) @@ -779,7 +779,7 @@ static int bus_cgroup_set_boolean( CGroupMask mask, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { int b, r; @@ -805,7 +805,7 @@ static int bus_cgroup_set_boolean( uint64_t *p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ uint64_t v; \ int r; \ @@ -817,7 +817,7 @@ static int bus_cgroup_set_boolean( return r; \ \ if (!check(v)) \ - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \ + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, \ "Value specified in %s is out of range", name); \ \ if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \ @@ -842,7 +842,7 @@ static int bus_cgroup_set_boolean( uint64_t *p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ uint64_t v; \ int r; \ @@ -854,7 +854,7 @@ static int bus_cgroup_set_boolean( return r; \ \ if (v < minimum) \ - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \ + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, \ "Value specified in %s is out of range", name); \ \ if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \ @@ -877,7 +877,7 @@ static int bus_cgroup_set_boolean( uint64_t *p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ uint64_t v; \ uint32_t raw; \ @@ -891,7 +891,7 @@ static int bus_cgroup_set_boolean( \ v = scale(raw, UINT32_MAX); \ if (v < minimum || v >= UINT64_MAX) \ - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \ + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, \ "Value specified in %s is out of range", name); \ \ if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \ @@ -924,7 +924,7 @@ static int bus_cgroup_set_cpu_weight( uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t v; int r; assert(p); @@ -933,7 +933,7 @@ static int bus_cgroup_set_cpu_weight( return r; if (!CGROUP_WEIGHT_IS_OK(v) && v != CGROUP_WEIGHT_IDLE) return sd_bus_error_setf( - error, SD_BUS_ERROR_INVALID_ARGS, "Value specified in %s is out of range", name); + reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Value specified in %s is out of range", name); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { *p = v; unit_invalidate_cgroup(u, CGROUP_MASK_CPU); @@ -953,7 +953,7 @@ static int bus_cgroup_set_tasks_max( CGroupTasksMax *p, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t v; int r; @@ -965,7 +965,7 @@ static int bus_cgroup_set_tasks_max( return r; if (v < 1) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Value specified in %s is out of range", name); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -989,7 +989,7 @@ static int bus_cgroup_set_tasks_max_scale( CGroupTasksMax *p, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint32_t v; int r; @@ -1001,7 +1001,7 @@ static int bus_cgroup_set_tasks_max_scale( return r; if (v < 1 || v >= UINT32_MAX) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Value specified in %s is out of range", name); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -1022,7 +1022,7 @@ int bus_cgroup_set_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { CGroupIOLimitType iol_type; int r; @@ -1035,156 +1035,156 @@ int bus_cgroup_set_property( flags |= UNIT_PRIVATE; if (streq(name, "CPUWeight")) - return bus_cgroup_set_cpu_weight(u, name, &c->cpu_weight, message, flags, error); + return bus_cgroup_set_cpu_weight(u, name, &c->cpu_weight, message, flags, reterr_error); if (streq(name, "StartupCPUWeight")) - return bus_cgroup_set_cpu_weight(u, name, &c->startup_cpu_weight, message, flags, error); + return bus_cgroup_set_cpu_weight(u, name, &c->startup_cpu_weight, message, flags, reterr_error); if (streq(name, "IOAccounting")) - return bus_cgroup_set_boolean(u, name, &c->io_accounting, CGROUP_MASK_IO, message, flags, error); + return bus_cgroup_set_boolean(u, name, &c->io_accounting, CGROUP_MASK_IO, message, flags, reterr_error); if (streq(name, "IOWeight")) - return bus_cgroup_set_io_weight(u, name, &c->io_weight, message, flags, error); + return bus_cgroup_set_io_weight(u, name, &c->io_weight, message, flags, reterr_error); if (streq(name, "StartupIOWeight")) - return bus_cgroup_set_io_weight(u, name, &c->startup_io_weight, message, flags, error); + return bus_cgroup_set_io_weight(u, name, &c->startup_io_weight, message, flags, reterr_error); if (streq(name, "MemoryAccounting")) - return bus_cgroup_set_boolean(u, name, &c->memory_accounting, CGROUP_MASK_MEMORY, message, flags, error); + return bus_cgroup_set_boolean(u, name, &c->memory_accounting, CGROUP_MASK_MEMORY, message, flags, reterr_error); if (streq(name, "MemoryMin")) { - r = bus_cgroup_set_memory_protection(u, name, &c->memory_min, message, flags, error); + r = bus_cgroup_set_memory_protection(u, name, &c->memory_min, message, flags, reterr_error); if (r > 0) c->memory_min_set = true; return r; } if (streq(name, "MemoryLow")) { - r = bus_cgroup_set_memory_protection(u, name, &c->memory_low, message, flags, error); + r = bus_cgroup_set_memory_protection(u, name, &c->memory_low, message, flags, reterr_error); if (r > 0) c->memory_low_set = true; return r; } if (streq(name, "StartupMemoryLow")) { - r = bus_cgroup_set_memory_protection(u, name, &c->startup_memory_low, message, flags, error); + r = bus_cgroup_set_memory_protection(u, name, &c->startup_memory_low, message, flags, reterr_error); if (r > 0) c->startup_memory_low_set = true; return r; } if (streq(name, "DefaultMemoryMin")) { - r = bus_cgroup_set_memory_protection(u, name, &c->default_memory_min, message, flags, error); + r = bus_cgroup_set_memory_protection(u, name, &c->default_memory_min, message, flags, reterr_error); if (r > 0) c->default_memory_min_set = true; return r; } if (streq(name, "DefaultMemoryLow")) { - r = bus_cgroup_set_memory_protection(u, name, &c->default_memory_low, message, flags, error); + r = bus_cgroup_set_memory_protection(u, name, &c->default_memory_low, message, flags, reterr_error); if (r > 0) c->default_memory_low_set = true; return r; } if (streq(name, "DefaultStartupMemoryLow")) { - r = bus_cgroup_set_memory_protection(u, name, &c->default_startup_memory_low, message, flags, error); + r = bus_cgroup_set_memory_protection(u, name, &c->default_startup_memory_low, message, flags, reterr_error); if (r > 0) c->default_startup_memory_low_set = true; return r; } if (streq(name, "MemoryHigh")) - return bus_cgroup_set_memory(u, name, &c->memory_high, message, flags, error); + return bus_cgroup_set_memory(u, name, &c->memory_high, message, flags, reterr_error); if (streq(name, "StartupMemoryHigh")) { - r = bus_cgroup_set_memory(u, name, &c->startup_memory_high, message, flags, error); + r = bus_cgroup_set_memory(u, name, &c->startup_memory_high, message, flags, reterr_error); if (r > 0) c->startup_memory_high_set = true; return r; } if (streq(name, "MemorySwapMax")) - return bus_cgroup_set_swap(u, name, &c->memory_swap_max, message, flags, error); + return bus_cgroup_set_swap(u, name, &c->memory_swap_max, message, flags, reterr_error); if (streq(name, "StartupMemorySwapMax")) { - r = bus_cgroup_set_swap(u, name, &c->startup_memory_swap_max, message, flags, error); + r = bus_cgroup_set_swap(u, name, &c->startup_memory_swap_max, message, flags, reterr_error); if (r > 0) c->startup_memory_swap_max_set = true; return r; } if (streq(name, "MemoryZSwapMax")) - return bus_cgroup_set_zswap(u, name, &c->memory_zswap_max, message, flags, error); + return bus_cgroup_set_zswap(u, name, &c->memory_zswap_max, message, flags, reterr_error); if (streq(name, "StartupMemoryZSwapMax")) { - r = bus_cgroup_set_zswap(u, name, &c->startup_memory_zswap_max, message, flags, error); + r = bus_cgroup_set_zswap(u, name, &c->startup_memory_zswap_max, message, flags, reterr_error); if (r > 0) c->startup_memory_zswap_max_set = true; return r; } if (streq(name, "MemoryMax")) - return bus_cgroup_set_memory(u, name, &c->memory_max, message, flags, error); + return bus_cgroup_set_memory(u, name, &c->memory_max, message, flags, reterr_error); if (streq(name, "StartupMemoryMax")) { - r = bus_cgroup_set_memory(u, name, &c->startup_memory_max, message, flags, error); + r = bus_cgroup_set_memory(u, name, &c->startup_memory_max, message, flags, reterr_error); if (r > 0) c->startup_memory_max_set = true; return r; } if (streq(name, "MemoryMinScale")) { - r = bus_cgroup_set_memory_protection_scale(u, name, &c->memory_min, message, flags, error); + r = bus_cgroup_set_memory_protection_scale(u, name, &c->memory_min, message, flags, reterr_error); if (r > 0) c->memory_min_set = true; return r; } if (streq(name, "MemoryLowScale")) { - r = bus_cgroup_set_memory_protection_scale(u, name, &c->memory_low, message, flags, error); + r = bus_cgroup_set_memory_protection_scale(u, name, &c->memory_low, message, flags, reterr_error); if (r > 0) c->memory_low_set = true; return r; } if (streq(name, "DefaultMemoryMinScale")) { - r = bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_min, message, flags, error); + r = bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_min, message, flags, reterr_error); if (r > 0) c->default_memory_min_set = true; return r; } if (streq(name, "DefaultMemoryLowScale")) { - r = bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_low, message, flags, error); + r = bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_low, message, flags, reterr_error); if (r > 0) c->default_memory_low_set = true; return r; } if (streq(name, "MemoryHighScale")) - return bus_cgroup_set_memory_scale(u, name, &c->memory_high, message, flags, error); + return bus_cgroup_set_memory_scale(u, name, &c->memory_high, message, flags, reterr_error); if (streq(name, "MemorySwapMaxScale")) - return bus_cgroup_set_swap_scale(u, name, &c->memory_swap_max, message, flags, error); + return bus_cgroup_set_swap_scale(u, name, &c->memory_swap_max, message, flags, reterr_error); if (streq(name, "MemoryZSwapMaxScale")) - return bus_cgroup_set_zswap_scale(u, name, &c->memory_zswap_max, message, flags, error); + return bus_cgroup_set_zswap_scale(u, name, &c->memory_zswap_max, message, flags, reterr_error); if (streq(name, "MemoryMaxScale")) - return bus_cgroup_set_memory_scale(u, name, &c->memory_max, message, flags, error); + return bus_cgroup_set_memory_scale(u, name, &c->memory_max, message, flags, reterr_error); if (streq(name, "MemoryZSwapWriteback")) - return bus_cgroup_set_boolean(u, name, &c->memory_zswap_writeback, CGROUP_MASK_MEMORY, message, flags, error); + return bus_cgroup_set_boolean(u, name, &c->memory_zswap_writeback, CGROUP_MASK_MEMORY, message, flags, reterr_error); if (streq(name, "TasksAccounting")) - return bus_cgroup_set_boolean(u, name, &c->tasks_accounting, CGROUP_MASK_PIDS, message, flags, error); + return bus_cgroup_set_boolean(u, name, &c->tasks_accounting, CGROUP_MASK_PIDS, message, flags, reterr_error); if (streq(name, "TasksMax")) - return bus_cgroup_set_tasks_max(u, name, &c->tasks_max, message, flags, error); + return bus_cgroup_set_tasks_max(u, name, &c->tasks_max, message, flags, reterr_error); if (streq(name, "TasksMaxScale")) - return bus_cgroup_set_tasks_max_scale(u, name, &c->tasks_max, message, flags, error); + return bus_cgroup_set_tasks_max_scale(u, name, &c->tasks_max, message, flags, reterr_error); if (streq(name, "CPUQuotaPerSecUSec")) { uint64_t u64; @@ -1194,7 +1194,7 @@ int bus_cgroup_set_property( return r; if (u64 <= 0) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "CPUQuotaPerSecUSec= value out of range"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "CPUQuotaPerSecUSec= value out of range"); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->cpu_quota_per_sec_usec = u64; @@ -1289,7 +1289,7 @@ int bus_cgroup_set_property( while ((r = sd_bus_message_read(message, "(st)", &path, &u64)) > 0) { if (!path_is_normalized(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path '%s' specified in %s= is not normalized.", name, path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path '%s' specified in %s= is not normalized.", name, path); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { CGroupIODeviceLimit *a = NULL; @@ -1372,10 +1372,10 @@ int bus_cgroup_set_property( while ((r = sd_bus_message_read(message, "(st)", &path, &weight)) > 0) { if (!path_is_normalized(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path '%s' specified in %s= is not normalized.", name, path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path '%s' specified in %s= is not normalized.", name, path); if (!CGROUP_WEIGHT_IS_OK(weight) || weight == CGROUP_WEIGHT_INVALID) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "IODeviceWeight= value out of range"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "IODeviceWeight= value out of range"); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { CGroupIODeviceWeight *a = NULL; @@ -1449,7 +1449,7 @@ int bus_cgroup_set_property( while ((r = sd_bus_message_read(message, "(st)", &path, &target)) > 0) { if (!path_is_normalized(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path '%s' specified in %s= is not normalized.", name, path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path '%s' specified in %s= is not normalized.", name, path); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { CGroupIODeviceLatency *a = NULL; @@ -1544,14 +1544,14 @@ int bus_cgroup_set_property( CGroupDevicePermissions p; if (!valid_device_allow_pattern(path) || strpbrk(path, WHITESPACE)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "DeviceAllow= requires device node or pattern"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "DeviceAllow= requires device node or pattern"); if (isempty(rwm)) p = _CGROUP_DEVICE_PERMISSIONS_ALL; else { p = cgroup_device_permissions_from_string(rwm); if (p < 0) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "DeviceAllow= requires combination of rwm flags"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "DeviceAllow= requires combination of rwm flags"); } if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -1629,7 +1629,7 @@ int bus_cgroup_set_property( break; struct in_addr_prefix prefix; - r = bus_message_read_in_addr_auto(message, error, &prefix.family, &prefix.address); + r = bus_message_read_in_addr_auto(message, reterr_error, &prefix.family, &prefix.address); if (r < 0) return r; @@ -1639,7 +1639,7 @@ int bus_cgroup_set_property( return r; if (prefixlen > FAMILY_ADDRESS_SIZE(prefix.family)*8) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Prefix length %" PRIu32 " too large for address family %s.", prefixlen, af_to_name(prefix.family)); @@ -1713,7 +1713,7 @@ int bus_cgroup_set_property( const char *mode; if (!UNIT_VTABLE(u)->can_set_managed_oom) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Cannot set %s for this unit type", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Cannot set %s for this unit type", name); r = sd_bus_message_read(message, "s", &mode); if (r < 0) @@ -1736,7 +1736,7 @@ int bus_cgroup_set_property( uint32_t v; if (!UNIT_VTABLE(u)->can_set_managed_oom) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Cannot set %s for this unit type", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Cannot set %s for this unit type", name); r = sd_bus_message_read(message, "u", &v); if (r < 0) @@ -1759,14 +1759,14 @@ int bus_cgroup_set_property( uint64_t t; if (!UNIT_VTABLE(u)->can_set_managed_oom) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Cannot set %s for this unit type", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Cannot set %s for this unit type", name); r = sd_bus_message_read(message, "t", &t); if (r < 0) return r; if (t < 1 * USEC_PER_SEC) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= must be at least 1s, got %s", name, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= must be at least 1s, got %s", name, FORMAT_TIMESPAN(t, USEC_PER_SEC)); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -1819,16 +1819,16 @@ int bus_cgroup_set_property( while ((r = sd_bus_message_read(message, "(iiqq)", &family, &ip_protocol, &nr_ports, &port_min)) > 0) { if (!IN_SET(family, AF_UNSPEC, AF_INET, AF_INET6)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects INET or INET6 family, if specified.", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects INET or INET6 family, if specified.", name); if (!IN_SET(ip_protocol, 0, IPPROTO_TCP, IPPROTO_UDP)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects TCP or UDP protocol, if specified.", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects TCP or UDP protocol, if specified.", name); if (port_min + (uint32_t) nr_ports > (1 << 16)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects maximum port value lesser than 65536.", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects maximum port value lesser than 65536.", name); if (port_min == 0 && nr_ports != 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects port range starting with positive value.", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects port range starting with positive value.", name); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ CGroupSocketBindItem *item = NULL; @@ -1963,27 +1963,27 @@ int bus_cgroup_set_property( const char *source_name, *nfproto_name; if (!IN_SET(source, NFT_SET_SOURCE_CGROUP, NFT_SET_SOURCE_USER, NFT_SET_SOURCE_GROUP)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid source %d.", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid source %d.", source); source_name = nft_set_source_to_string(source); assert(source_name); nfproto_name = nfproto_to_string(nfproto); if (!nfproto_name) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid protocol %d.", nfproto); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid protocol %d.", nfproto); if (!nft_identifier_valid(table)) { _cleanup_free_ char *esc = NULL; esc = cescape(table); - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NFT table name %s.", strna(esc)); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NFT table name %s.", strna(esc)); } if (!nft_identifier_valid(set)) { _cleanup_free_ char *esc = NULL; esc = cescape(set); - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NFT set name %s.", strna(esc)); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NFT set name %s.", strna(esc)); } if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -2041,7 +2041,7 @@ int bus_cgroup_set_property( /* must be last */ if (streq(name, "DisableControllers") || (u->transient && u->load_state == UNIT_STUB)) - return bus_cgroup_set_transient_property(u, c, name, message, flags, error); + return bus_cgroup_set_transient_property(u, c, name, message, flags, reterr_error); return 0; } diff --git a/src/core/dbus-cgroup.h b/src/core/dbus-cgroup.h index cd62979002b..e1fdf65a8fa 100644 --- a/src/core/dbus-cgroup.h +++ b/src/core/dbus-cgroup.h @@ -7,7 +7,27 @@ extern const sd_bus_vtable bus_cgroup_vtable[]; -int bus_property_get_tasks_max(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *ret_error); -int bus_property_get_cgroup_pressure_watch(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *ret_error); +int bus_property_get_tasks_max( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); +int bus_property_get_cgroup_pressure_watch( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); -int bus_cgroup_set_property(Unit *u, CGroupContext *c, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); +int bus_cgroup_set_property( + Unit *u, + CGroupContext *c, + const char *name, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index a349c001611..83b0ddcb9e1 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -86,7 +86,7 @@ static int property_get_environment_files( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); int r; @@ -116,7 +116,7 @@ static int property_get_cpu_affinity( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); _cleanup_(cpu_set_done) CPUSet s = {}; @@ -146,7 +146,7 @@ static int property_get_numa_mask( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); _cleanup_free_ uint8_t *array = NULL; @@ -167,7 +167,7 @@ static int property_get_numa_policy( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); int32_t policy; @@ -186,7 +186,7 @@ static int property_get_syscall_filter( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); _cleanup_strv_free_ char **l = NULL; @@ -221,7 +221,7 @@ static int property_get_syscall_log( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); _cleanup_strv_free_ char **l = NULL; @@ -256,7 +256,7 @@ static int property_get_syscall_archs( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); _cleanup_strv_free_ char **l = NULL; @@ -283,7 +283,7 @@ static int property_get_selinux_context( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); @@ -300,7 +300,7 @@ static int property_get_apparmor_profile( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); @@ -317,7 +317,7 @@ static int property_get_smack_process_label( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); @@ -334,7 +334,7 @@ static int property_get_address_families( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); _cleanup_strv_free_ char **l = NULL; @@ -369,7 +369,7 @@ static int property_get_working_directory( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); const char *wd; @@ -395,7 +395,7 @@ static int property_get_stdio_fdname( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); int fileno; @@ -423,7 +423,7 @@ static int property_get_input_data( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); @@ -441,7 +441,7 @@ static int property_get_restrict_filesystems( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); _cleanup_free_ char **l = NULL; /* Strings are owned by 'c->restrict_filesystems'! */ @@ -476,7 +476,7 @@ static int property_get_bind_paths( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); bool ro; @@ -516,7 +516,7 @@ static int property_get_temporary_filesystems( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); int r; @@ -548,7 +548,7 @@ static int property_get_log_extra_fields( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); int r; @@ -592,7 +592,7 @@ static int property_get_log_filter_patterns( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = userdata; int r; @@ -624,7 +624,7 @@ static int property_get_set_credential( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); ExecSetCredential *sc; @@ -670,7 +670,7 @@ static int property_get_load_credential( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); ExecLoadCredential *lc; @@ -704,7 +704,7 @@ static int property_get_import_credential( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); ExecImportCredential *ic; @@ -734,7 +734,7 @@ static int property_get_import_credential_ex( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); ExecImportCredential *ic; @@ -764,7 +764,7 @@ static int property_get_root_hash( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); @@ -782,7 +782,7 @@ static int property_get_root_hash_sig( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); @@ -800,7 +800,7 @@ static int property_get_root_image_options( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); int r; @@ -831,7 +831,7 @@ static int property_get_mount_images( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); int r; @@ -888,7 +888,7 @@ static int property_get_extension_images( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); int r; @@ -944,7 +944,7 @@ static int property_get_exec_dir( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecDirectory *d = ASSERT_PTR(userdata); int r; @@ -973,7 +973,7 @@ static int property_get_exec_dir_symlink( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecDirectory *d = ASSERT_PTR(userdata); int r; @@ -1009,7 +1009,7 @@ static int property_get_exec_quota(sd_bus *bus, const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { QuotaLimit *q = ASSERT_PTR(userdata); @@ -1026,7 +1026,7 @@ static int property_get_image_policy( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ImagePolicy **pp = ASSERT_PTR(userdata); _cleanup_free_ char *s = NULL; @@ -1050,7 +1050,7 @@ static int property_get_private_tmp( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { PrivateTmp *p = ASSERT_PTR(userdata); int b = *p != PRIVATE_TMP_NO; @@ -1065,7 +1065,7 @@ static int property_get_private_users( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { PrivateUsers *p = ASSERT_PTR(userdata); int b = *p != PRIVATE_USERS_NO; @@ -1080,7 +1080,7 @@ static int property_get_protect_control_groups( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ProtectControlGroups *p = ASSERT_PTR(userdata); int b = *p != PROTECT_CONTROL_GROUPS_NO; @@ -1095,7 +1095,7 @@ static int property_get_protect_hostname( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ProtectHostname *p = ASSERT_PTR(userdata); int b = *p != PROTECT_HOSTNAME_NO; @@ -1110,7 +1110,7 @@ static int property_get_protect_hostname_ex( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ExecContext *c = ASSERT_PTR(userdata); @@ -1124,7 +1124,7 @@ static int property_get_unsigned_as_uint16( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { unsigned *value = ASSERT_PTR(userdata); @@ -1141,7 +1141,7 @@ static int property_get_bpf_delegate_commands( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t *u = ASSERT_PTR(userdata); _cleanup_free_ char *s = NULL; @@ -1162,7 +1162,7 @@ static int property_get_bpf_delegate_maps( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t *u = ASSERT_PTR(userdata); _cleanup_free_ char *s = NULL; @@ -1183,7 +1183,7 @@ static int property_get_bpf_delegate_programs( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t *u = ASSERT_PTR(userdata); _cleanup_free_ char *s = NULL; @@ -1204,7 +1204,7 @@ static int property_get_bpf_delegate_attachments( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t *u = ASSERT_PTR(userdata); _cleanup_free_ char *s = NULL; @@ -1431,7 +1431,7 @@ static int property_get_quota_usage( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); ExecContext *c = ASSERT_PTR(unit_get_exec_context(u)); @@ -1565,7 +1565,7 @@ int bus_property_get_exec_command( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *ret_error) { + sd_bus_error *reterr_error) { ExecCommand *c = (ExecCommand*) userdata; int r; @@ -1591,7 +1591,7 @@ int bus_property_get_exec_command_list( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *ret_error) { + sd_bus_error *reterr_error) { ExecCommand *exec_command = *(ExecCommand**) userdata; int r; @@ -1619,7 +1619,7 @@ int bus_property_get_exec_ex_command_list( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *ret_error) { + sd_bus_error *reterr_error) { ExecCommand *exec_command = *(ExecCommand**) userdata; int r; @@ -1654,7 +1654,7 @@ int bus_set_transient_exec_command( ExecCommand **exec_command, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { const char *ex_prop = endswith(ASSERT_PTR(name), "Ex"); size_t n = 0; @@ -1663,7 +1663,7 @@ int bus_set_transient_exec_command( assert(u); assert(exec_command); assert(message); - assert(error); + assert(reterr_error); /* Drop Ex from the written setting. E.g. ExecStart=, not ExecStartEx=. */ const char *written_name = ex_prop ? strndupa_safe(name, ex_prop - name) : name; @@ -1707,12 +1707,12 @@ int bus_set_transient_exec_command( if (!FLAGS_SET(command_flags, EXEC_COMMAND_VIA_SHELL)) { if (!filename_or_absolute_path_is_valid(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "\"%s\" is neither a valid executable name nor an absolute path", path); if (strv_isempty(argv)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "\"%s\" argv cannot be empty", name); } else { /* Always normalize path and argv0 to be "sh" */ @@ -1862,7 +1862,7 @@ int bus_exec_context_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { const char *suffix; int r; @@ -1875,25 +1875,25 @@ int bus_exec_context_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "User")) - return bus_set_transient_user_relaxed(u, name, &c->user, message, flags, error); + return bus_set_transient_user_relaxed(u, name, &c->user, message, flags, reterr_error); if (streq(name, "Group")) - return bus_set_transient_user_relaxed(u, name, &c->group, message, flags, error); + return bus_set_transient_user_relaxed(u, name, &c->group, message, flags, reterr_error); if (streq(name, "SetLoginEnvironment")) - return bus_set_transient_tristate(u, name, &c->set_login_environment, message, flags, error); + return bus_set_transient_tristate(u, name, &c->set_login_environment, message, flags, reterr_error); if (streq(name, "TTYPath")) - return bus_set_transient_path(u, name, &c->tty_path, message, flags, error); + return bus_set_transient_path(u, name, &c->tty_path, message, flags, reterr_error); if (streq(name, "RootImage")) - return bus_set_transient_path(u, name, &c->root_image, message, flags, error); + return bus_set_transient_path(u, name, &c->root_image, message, flags, reterr_error); if (streq(name, "RootImageOptions")) { _cleanup_(mount_options_free_allp) MountOptions *options = NULL; _cleanup_free_ char *format_str = NULL; - r = bus_read_mount_options(message, error, &options, &format_str, " "); + r = bus_read_mount_options(message, reterr_error, &options, &format_str, " "); if (r < 0) return r; @@ -1950,7 +1950,7 @@ int bus_exec_context_set_transient_property( if (streq(name, "RootHashPath")) { iovec_done(&c->root_hash); - return bus_set_transient_path(u, "RootHash", &c->root_hash_path, message, flags, error); + return bus_set_transient_path(u, "RootHash", &c->root_hash_path, message, flags, reterr_error); } if (streq(name, "RootHashSignature")) { @@ -1989,29 +1989,29 @@ int bus_exec_context_set_transient_property( if (streq(name, "RootHashSignaturePath")) { iovec_done(&c->root_hash_sig); - return bus_set_transient_path(u, "RootHashSignature", &c->root_hash_sig_path, message, flags, error); + return bus_set_transient_path(u, "RootHashSignature", &c->root_hash_sig_path, message, flags, reterr_error); } if (streq(name, "RootVerity")) - return bus_set_transient_path(u, name, &c->root_verity, message, flags, error); + return bus_set_transient_path(u, name, &c->root_verity, message, flags, reterr_error); if (streq(name, "RootDirectory")) - return bus_set_transient_path(u, name, &c->root_directory, message, flags, error); + return bus_set_transient_path(u, name, &c->root_directory, message, flags, reterr_error); if (streq(name, "RootEphemeral")) - return bus_set_transient_bool(u, name, &c->root_ephemeral, message, flags, error); + return bus_set_transient_bool(u, name, &c->root_ephemeral, message, flags, reterr_error); if (streq(name, "SyslogIdentifier")) - return bus_set_transient_string(u, name, &c->syslog_identifier, message, flags, error); + return bus_set_transient_string(u, name, &c->syslog_identifier, message, flags, reterr_error); if (streq(name, "LogLevelMax")) - return bus_set_transient_log_level(u, name, &c->log_level_max, message, flags, error); + return bus_set_transient_log_level(u, name, &c->log_level_max, message, flags, reterr_error); if (streq(name, "LogRateLimitIntervalUSec")) - return bus_set_transient_usec(u, name, &c->log_ratelimit.interval, message, flags, error); + return bus_set_transient_usec(u, name, &c->log_ratelimit.interval, message, flags, reterr_error); if (streq(name, "LogRateLimitBurst")) - return bus_set_transient_unsigned(u, name, &c->log_ratelimit.burst, message, flags, error); + return bus_set_transient_unsigned(u, name, &c->log_ratelimit.burst, message, flags, reterr_error); if (streq(name, "LogFilterPatterns")) { /* Use _cleanup_free_, not _cleanup_strv_free_, as we don't want the content of the strv @@ -2069,34 +2069,34 @@ int bus_exec_context_set_transient_property( } if (streq(name, "Personality")) - return bus_set_transient_personality(u, name, &c->personality, message, flags, error); + return bus_set_transient_personality(u, name, &c->personality, message, flags, reterr_error); if (streq(name, "StandardInput")) - return bus_set_transient_std_input(u, name, &c->std_input, message, flags, error); + return bus_set_transient_std_input(u, name, &c->std_input, message, flags, reterr_error); if (streq(name, "StandardOutput")) - return bus_set_transient_std_output(u, name, &c->std_output, message, flags, error); + return bus_set_transient_std_output(u, name, &c->std_output, message, flags, reterr_error); if (streq(name, "StandardError")) - return bus_set_transient_std_output(u, name, &c->std_error, message, flags, error); + return bus_set_transient_std_output(u, name, &c->std_error, message, flags, reterr_error); if (streq(name, "IgnoreSIGPIPE")) - return bus_set_transient_bool(u, name, &c->ignore_sigpipe, message, flags, error); + return bus_set_transient_bool(u, name, &c->ignore_sigpipe, message, flags, reterr_error); if (streq(name, "TTYVHangup")) - return bus_set_transient_bool(u, name, &c->tty_vhangup, message, flags, error); + return bus_set_transient_bool(u, name, &c->tty_vhangup, message, flags, reterr_error); if (streq(name, "TTYReset")) - return bus_set_transient_bool(u, name, &c->tty_reset, message, flags, error); + return bus_set_transient_bool(u, name, &c->tty_reset, message, flags, reterr_error); if (streq(name, "TTYVTDisallocate")) - return bus_set_transient_bool(u, name, &c->tty_vt_disallocate, message, flags, error); + return bus_set_transient_bool(u, name, &c->tty_vt_disallocate, message, flags, reterr_error); if (streq(name, "TTYRows")) - return bus_set_transient_unsigned(u, name, &c->tty_rows, message, flags, error); + return bus_set_transient_unsigned(u, name, &c->tty_rows, message, flags, reterr_error); if (streq(name, "TTYColumns")) - return bus_set_transient_unsigned(u, name, &c->tty_cols, message, flags, error); + return bus_set_transient_unsigned(u, name, &c->tty_cols, message, flags, reterr_error); if (streq(name, "PrivateTmp")) { int v; @@ -2122,7 +2122,7 @@ int bus_exec_context_set_transient_property( t = private_tmp_from_string(s); if (t < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->private_tmp = t; @@ -2157,7 +2157,7 @@ int bus_exec_context_set_transient_property( t = private_users_from_string(s); if (t < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->private_users = t; @@ -2193,7 +2193,7 @@ int bus_exec_context_set_transient_property( t = protect_control_groups_from_string(s); if (t < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->protect_control_groups = t; @@ -2214,7 +2214,7 @@ int bus_exec_context_set_transient_property( t = private_pids_from_string(s); if (t < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->private_pids = t; @@ -2249,11 +2249,11 @@ int bus_exec_context_set_transient_property( return r; if (!isempty(h) && !hostname_is_valid(h, /* flags = */ 0)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid hostname in %s setting: %s", name, h); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid hostname in %s setting: %s", name, h); ProtectHostname t = protect_hostname_from_string(s); if (t < 0 || (t == PROTECT_HOSTNAME_NO && !isempty(h))) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s setting: %s", name, s); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->protect_hostname = t; @@ -2271,157 +2271,157 @@ int bus_exec_context_set_transient_property( } if (streq(name, "PrivateDevices")) - return bus_set_transient_bool(u, name, &c->private_devices, message, flags, error); + return bus_set_transient_bool(u, name, &c->private_devices, message, flags, reterr_error); if (streq(name, "PrivateMounts")) - return bus_set_transient_tristate(u, name, &c->private_mounts, message, flags, error); + return bus_set_transient_tristate(u, name, &c->private_mounts, message, flags, reterr_error); if (streq(name, "MountAPIVFS")) - return bus_set_transient_tristate(u, name, &c->mount_apivfs, message, flags, error); + return bus_set_transient_tristate(u, name, &c->mount_apivfs, message, flags, reterr_error); if (streq(name, "BindLogSockets")) - return bus_set_transient_tristate(u, name, &c->bind_log_sockets, message, flags, error); + return bus_set_transient_tristate(u, name, &c->bind_log_sockets, message, flags, reterr_error); if (streq(name, "PrivateNetwork")) - return bus_set_transient_bool(u, name, &c->private_network, message, flags, error); + return bus_set_transient_bool(u, name, &c->private_network, message, flags, reterr_error); if (streq(name, "PrivateIPC")) - return bus_set_transient_bool(u, name, &c->private_ipc, message, flags, error); + return bus_set_transient_bool(u, name, &c->private_ipc, message, flags, reterr_error); if (streq(name, "NoNewPrivileges")) - return bus_set_transient_bool(u, name, &c->no_new_privileges, message, flags, error); + return bus_set_transient_bool(u, name, &c->no_new_privileges, message, flags, reterr_error); if (streq(name, "SyslogLevelPrefix")) - return bus_set_transient_bool(u, name, &c->syslog_level_prefix, message, flags, error); + return bus_set_transient_bool(u, name, &c->syslog_level_prefix, message, flags, reterr_error); if (streq(name, "MemoryDenyWriteExecute")) - return bus_set_transient_bool(u, name, &c->memory_deny_write_execute, message, flags, error); + return bus_set_transient_bool(u, name, &c->memory_deny_write_execute, message, flags, reterr_error); if (streq(name, "RestrictRealtime")) - return bus_set_transient_bool(u, name, &c->restrict_realtime, message, flags, error); + return bus_set_transient_bool(u, name, &c->restrict_realtime, message, flags, reterr_error); if (streq(name, "RestrictSUIDSGID")) - return bus_set_transient_bool(u, name, &c->restrict_suid_sgid, message, flags, error); + return bus_set_transient_bool(u, name, &c->restrict_suid_sgid, message, flags, reterr_error); if (streq(name, "DynamicUser")) - return bus_set_transient_bool(u, name, &c->dynamic_user, message, flags, error); + return bus_set_transient_bool(u, name, &c->dynamic_user, message, flags, reterr_error); if (streq(name, "RemoveIPC")) - return bus_set_transient_bool(u, name, &c->remove_ipc, message, flags, error); + return bus_set_transient_bool(u, name, &c->remove_ipc, message, flags, reterr_error); if (streq(name, "ProtectKernelTunables")) - return bus_set_transient_bool(u, name, &c->protect_kernel_tunables, message, flags, error); + return bus_set_transient_bool(u, name, &c->protect_kernel_tunables, message, flags, reterr_error); if (streq(name, "ProtectKernelModules")) - return bus_set_transient_bool(u, name, &c->protect_kernel_modules, message, flags, error); + return bus_set_transient_bool(u, name, &c->protect_kernel_modules, message, flags, reterr_error); if (streq(name, "ProtectKernelLogs")) - return bus_set_transient_bool(u, name, &c->protect_kernel_logs, message, flags, error); + return bus_set_transient_bool(u, name, &c->protect_kernel_logs, message, flags, reterr_error); if (streq(name, "ProtectClock")) - return bus_set_transient_bool(u, name, &c->protect_clock, message, flags, error); + return bus_set_transient_bool(u, name, &c->protect_clock, message, flags, reterr_error); if (streq(name, "CPUSchedulingResetOnFork")) - return bus_set_transient_bool(u, name, &c->cpu_sched_reset_on_fork, message, flags, error); + return bus_set_transient_bool(u, name, &c->cpu_sched_reset_on_fork, message, flags, reterr_error); if (streq(name, "NonBlocking")) - return bus_set_transient_bool(u, name, &c->non_blocking, message, flags, error); + return bus_set_transient_bool(u, name, &c->non_blocking, message, flags, reterr_error); if (streq(name, "LockPersonality")) - return bus_set_transient_bool(u, name, &c->lock_personality, message, flags, error); + return bus_set_transient_bool(u, name, &c->lock_personality, message, flags, reterr_error); if (streq(name, "MemoryKSM")) - return bus_set_transient_tristate(u, name, &c->memory_ksm, message, flags, error); + return bus_set_transient_tristate(u, name, &c->memory_ksm, message, flags, reterr_error); if (streq(name, "UtmpIdentifier")) - return bus_set_transient_string(u, name, &c->utmp_id, message, flags, error); + return bus_set_transient_string(u, name, &c->utmp_id, message, flags, reterr_error); if (streq(name, "UtmpMode")) - return bus_set_transient_utmp_mode(u, name, &c->utmp_mode, message, flags, error); + return bus_set_transient_utmp_mode(u, name, &c->utmp_mode, message, flags, reterr_error); if (streq(name, "PAMName")) - return bus_set_transient_string(u, name, &c->pam_name, message, flags, error); + return bus_set_transient_string(u, name, &c->pam_name, message, flags, reterr_error); if (streq(name, "TimerSlackNSec")) - return bus_set_transient_nsec(u, name, &c->timer_slack_nsec, message, flags, error); + return bus_set_transient_nsec(u, name, &c->timer_slack_nsec, message, flags, reterr_error); if (streq(name, "ProtectSystem")) - return bus_set_transient_protect_system(u, name, &c->protect_system, message, flags, error); + return bus_set_transient_protect_system(u, name, &c->protect_system, message, flags, reterr_error); if (streq(name, "ProtectHome")) - return bus_set_transient_protect_home(u, name, &c->protect_home, message, flags, error); + return bus_set_transient_protect_home(u, name, &c->protect_home, message, flags, reterr_error); if (streq(name, "KeyringMode")) - return bus_set_transient_keyring_mode(u, name, &c->keyring_mode, message, flags, error); + return bus_set_transient_keyring_mode(u, name, &c->keyring_mode, message, flags, reterr_error); if (streq(name, "ProtectProc")) - return bus_set_transient_protect_proc(u, name, &c->protect_proc, message, flags, error); + return bus_set_transient_protect_proc(u, name, &c->protect_proc, message, flags, reterr_error); if (streq(name, "ProcSubset")) - return bus_set_transient_proc_subset(u, name, &c->proc_subset, message, flags, error); + return bus_set_transient_proc_subset(u, name, &c->proc_subset, message, flags, reterr_error); if (streq(name, "PrivateBPF")) - return bus_set_transient_private_bpf(u, name, &c->private_bpf, message, flags, error); + return bus_set_transient_private_bpf(u, name, &c->private_bpf, message, flags, reterr_error); if (streq(name, "BPFDelegateCommands")) - return bus_set_transient_bpf_delegate_commands(u, name, &c->bpf_delegate_commands, message, flags, error); + return bus_set_transient_bpf_delegate_commands(u, name, &c->bpf_delegate_commands, message, flags, reterr_error); if (streq(name, "BPFDelegateMaps")) - return bus_set_transient_bpf_delegate_maps(u, name, &c->bpf_delegate_maps, message, flags, error); + return bus_set_transient_bpf_delegate_maps(u, name, &c->bpf_delegate_maps, message, flags, reterr_error); if (streq(name, "BPFDelegatePrograms")) - return bus_set_transient_bpf_delegate_programs(u, name, &c->bpf_delegate_programs, message, flags, error); + return bus_set_transient_bpf_delegate_programs(u, name, &c->bpf_delegate_programs, message, flags, reterr_error); if (streq(name, "BPFDelegateAttachments")) - return bus_set_transient_bpf_delegate_attachments(u, name, &c->bpf_delegate_attachments, message, flags, error); + return bus_set_transient_bpf_delegate_attachments(u, name, &c->bpf_delegate_attachments, message, flags, reterr_error); if (streq(name, "RuntimeDirectoryPreserve")) - return bus_set_transient_exec_preserve_mode(u, name, &c->runtime_directory_preserve_mode, message, flags, error); + return bus_set_transient_exec_preserve_mode(u, name, &c->runtime_directory_preserve_mode, message, flags, reterr_error); if (streq(name, "UMask")) - return bus_set_transient_mode_t(u, name, &c->umask, message, flags, error); + return bus_set_transient_mode_t(u, name, &c->umask, message, flags, reterr_error); if (streq(name, "RuntimeDirectoryMode")) - return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_RUNTIME].mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_RUNTIME].mode, message, flags, reterr_error); if (streq(name, "StateDirectoryAccounting")) - return bus_set_transient_bool(u, name, &c->directories[EXEC_DIRECTORY_STATE].exec_quota.quota_accounting, message, flags, error); + return bus_set_transient_bool(u, name, &c->directories[EXEC_DIRECTORY_STATE].exec_quota.quota_accounting, message, flags, reterr_error); if (streq(name, "CacheDirectoryAccounting")) - return bus_set_transient_bool(u, name, &c->directories[EXEC_DIRECTORY_CACHE].exec_quota.quota_accounting, message, flags, error); + return bus_set_transient_bool(u, name, &c->directories[EXEC_DIRECTORY_CACHE].exec_quota.quota_accounting, message, flags, reterr_error); if (streq(name, "LogsDirectoryAccounting")) - return bus_set_transient_bool(u, name, &c->directories[EXEC_DIRECTORY_LOGS].exec_quota.quota_accounting, message, flags, error); + return bus_set_transient_bool(u, name, &c->directories[EXEC_DIRECTORY_LOGS].exec_quota.quota_accounting, message, flags, reterr_error); if (streq(name, "StateDirectoryMode")) - return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_STATE].mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_STATE].mode, message, flags, reterr_error); if (streq(name, "CacheDirectoryMode")) - return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_CACHE].mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_CACHE].mode, message, flags, reterr_error); if (streq(name, "LogsDirectoryMode")) - return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_LOGS].mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_LOGS].mode, message, flags, reterr_error); if (streq(name, "ConfigurationDirectoryMode")) - return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_CONFIGURATION].mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &c->directories[EXEC_DIRECTORY_CONFIGURATION].mode, message, flags, reterr_error); if (streq(name, "SELinuxContext")) - return bus_set_transient_string(u, name, &c->selinux_context, message, flags, error); + return bus_set_transient_string(u, name, &c->selinux_context, message, flags, reterr_error); if (streq(name, "SecureBits")) - return bus_set_transient_secure_bits(u, name, &c->secure_bits, message, flags, error); + return bus_set_transient_secure_bits(u, name, &c->secure_bits, message, flags, reterr_error); if (streq(name, "CapabilityBoundingSet")) - return bus_set_transient_capability(u, name, &c->capability_bounding_set, message, flags, error); + return bus_set_transient_capability(u, name, &c->capability_bounding_set, message, flags, reterr_error); if (streq(name, "AmbientCapabilities")) - return bus_set_transient_capability(u, name, &c->capability_ambient_set, message, flags, error); + return bus_set_transient_capability(u, name, &c->capability_ambient_set, message, flags, reterr_error); if (streq(name, "RestrictNamespaces")) - return bus_set_transient_namespace_flag(u, name, &c->restrict_namespaces, message, flags, error); + return bus_set_transient_namespace_flag(u, name, &c->restrict_namespaces, message, flags, reterr_error); if (streq(name, "DelegateNamespaces")) - return bus_set_transient_namespace_flag(u, name, &c->delegate_namespaces, message, flags, error); + return bus_set_transient_namespace_flag(u, name, &c->delegate_namespaces, message, flags, reterr_error); if (streq(name, "RestrictFileSystems")) { int allow_list; @@ -2481,16 +2481,16 @@ int bus_exec_context_set_transient_property( } if (streq(name, "MountFlags")) - return bus_set_transient_mount_propagation_flag(u, name, &c->mount_propagation_flag, message, flags, error); + return bus_set_transient_mount_propagation_flag(u, name, &c->mount_propagation_flag, message, flags, reterr_error); if (streq(name, "NetworkNamespacePath")) - return bus_set_transient_path(u, name, &c->network_namespace_path, message, flags, error); + return bus_set_transient_path(u, name, &c->network_namespace_path, message, flags, reterr_error); if (streq(name, "UserNamespacePath")) - return bus_set_transient_path(u, name, &c->user_namespace_path, message, flags, error); + return bus_set_transient_path(u, name, &c->user_namespace_path, message, flags, reterr_error); if (streq(name, "IPCNamespacePath")) - return bus_set_transient_path(u, name, &c->ipc_namespace_path, message, flags, error); + return bus_set_transient_path(u, name, &c->ipc_namespace_path, message, flags, reterr_error); if (streq(name, "SupplementaryGroups")) { _cleanup_strv_free_ char **l = NULL; @@ -2501,7 +2501,7 @@ int bus_exec_context_set_transient_property( STRV_FOREACH(p, l) if (!isempty(*p) && !valid_user_group_name(*p, VALID_USER_ALLOW_NUMERIC|VALID_USER_RELAX|VALID_USER_WARN)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid supplementary group names"); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -2556,7 +2556,7 @@ int bus_exec_context_set_transient_property( return r; if (!credential_name_valid(id)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Credential ID is invalid: %s", id); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Credential ID is invalid: %s", id); isempty = false; @@ -2613,10 +2613,10 @@ int bus_exec_context_set_transient_property( break; if (!credential_name_valid(id)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Credential ID is invalid: %s", id); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Credential ID is invalid: %s", id); if (!(path_is_absolute(source) ? path_is_normalized(source) : credential_name_valid(source))) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Credential source is invalid: %s", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Credential source is invalid: %s", source); isempty = false; @@ -2662,12 +2662,12 @@ int bus_exec_context_set_transient_property( break; if (!credential_glob_valid(glob)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Credential name or glob is invalid: %s", glob); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Credential name or glob is invalid: %s", glob); rename = empty_to_null(rename); if (rename && !credential_name_valid(rename)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Credential name is invalid: %s", rename); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Credential name is invalid: %s", rename); empty = false; @@ -2701,7 +2701,7 @@ int bus_exec_context_set_transient_property( return r; if (!log_level_is_valid(level)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Log level value out of range"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Log level value out of range"); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->syslog_priority = (c->syslog_priority & LOG_FACMASK) | level; @@ -2718,7 +2718,7 @@ int bus_exec_context_set_transient_property( return r; if (!log_facility_unshifted_is_valid(facility)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Log facility value out of range"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Log facility value out of range"); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->syslog_priority = (facility << 3) | LOG_PRI(c->syslog_priority); @@ -2735,7 +2735,7 @@ int bus_exec_context_set_transient_property( return r; if (!isempty(n) && !log_namespace_name_valid(n)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Log namespace name not valid"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Log namespace name not valid"); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -2780,20 +2780,20 @@ int bus_exec_context_set_transient_property( break; if (memchr(p, 0, sz)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Journal field contains zero byte"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Journal field contains zero byte"); eq = memchr(p, '=', sz); if (!eq) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Journal field contains no '=' character"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Journal field contains no '=' character"); if (!journal_field_valid(p, eq - (const char*) p, false)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Journal field invalid"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Journal field invalid"); copy = memdup_suffix0(p, sz); if (!copy) return -ENOMEM; if (!utf8_is_valid(copy)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Journal field is not valid UTF-8"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Journal field is not valid UTF-8"); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { if (!GREEDY_REALLOC(c->log_extra_fields, c->n_log_extra_fields + 1)) @@ -2822,7 +2822,7 @@ int bus_exec_context_set_transient_property( #if HAVE_SECCOMP if (streq(name, "SystemCallErrorNumber")) - return bus_set_transient_errno(u, name, &c->syscall_errno, message, flags, error); + return bus_set_transient_errno(u, name, &c->syscall_errno, message, flags, reterr_error); if (streq(name, "SystemCallFilter")) { int allow_list; @@ -3123,7 +3123,7 @@ int bus_exec_context_set_transient_property( return r; if (!mpol_is_valid(type)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NUMAPolicy value: %i", type); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid NUMAPolicy value: %i", type); if (!UNIT_WRITE_FLAGS_NOOP(flags)) c->numa_policy.type = type; @@ -3138,7 +3138,7 @@ int bus_exec_context_set_transient_property( return r; if (!nice_is_valid(q)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid Nice value: %i", q); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid Nice value: %i", q); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->nice = q; @@ -3157,7 +3157,7 @@ int bus_exec_context_set_transient_property( return r; if (!sched_policy_is_valid(q)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid CPU scheduling policy: %i", q); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid CPU scheduling policy: %i", q); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *s = NULL; @@ -3185,7 +3185,7 @@ int bus_exec_context_set_transient_property( /* On Linux RR/FIFO range from 1 to 99 and OTHER/BATCH may only be 0. Policy might be set * later so we do not check the precise range, but only the generic outer bounds. */ if (p < 0 || p > 99) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid CPU scheduling priority: %i", p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid CPU scheduling priority: %i", p); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->cpu_sched_priority = p; @@ -3204,7 +3204,7 @@ int bus_exec_context_set_transient_property( return r; if (!ioprio_class_is_valid(q)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid IO scheduling class: %i", q); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid IO scheduling class: %i", q); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *s = NULL; @@ -3229,7 +3229,7 @@ int bus_exec_context_set_transient_property( return r; if (!ioprio_priority_is_valid(p)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid IO scheduling priority: %i", p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid IO scheduling priority: %i", p); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->ioprio = ioprio_normalize(ioprio_prio_value(ioprio_prio_class(c->ioprio), p)); @@ -3259,7 +3259,7 @@ int bus_exec_context_set_transient_property( is_home = true; else { if (!path_is_absolute(s)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "WorkingDirectory= expects an absolute path or '~'"); r = path_simplify_alloc(s, &simplified); @@ -3267,7 +3267,7 @@ int bus_exec_context_set_transient_property( return r; if (!path_is_normalized(simplified)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "WorkingDirectory= expects a normalized path or '~'"); } } @@ -3294,7 +3294,7 @@ int bus_exec_context_set_transient_property( return r; if (!isempty(s) && !fdname_is_valid(s)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid file descriptor name"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid file descriptor name"); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -3340,9 +3340,9 @@ int bus_exec_context_set_transient_property( if (!isempty(s)) { if (!path_is_absolute(s)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute", s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute", s); if (!path_is_normalized(s)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not normalized", s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not normalized", s); } if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -3446,7 +3446,7 @@ int bus_exec_context_set_transient_property( return r; if (!strv_env_is_valid(l)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment block."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment block."); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { if (strv_isempty(l)) { @@ -3480,7 +3480,7 @@ int bus_exec_context_set_transient_property( return r; if (!strv_env_name_or_assignment_is_valid(l)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid UnsetEnvironment= list."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid UnsetEnvironment= list."); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { if (strv_isempty(l)) { @@ -3513,7 +3513,7 @@ int bus_exec_context_set_transient_property( return r; if (!oom_score_adjust_is_valid(oa)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "OOM score adjust value out of range"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "OOM score adjust value out of range"); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { c->oom_score_adjust = oa; @@ -3577,7 +3577,7 @@ int bus_exec_context_set_transient_property( return r; if (!path_is_absolute(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute.", path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute.", path); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *q = NULL, *buf = NULL; @@ -3632,7 +3632,7 @@ int bus_exec_context_set_transient_property( return r; if (!strv_env_name_is_valid(l)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid PassEnvironment= block."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid PassEnvironment= block."); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { if (strv_isempty(l)) { @@ -3673,7 +3673,7 @@ int bus_exec_context_set_transient_property( offset = i[0] == '-'; offset += i[offset] == '+'; if (!path_is_absolute(i + offset)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s", name); path_simplify(i + offset); } @@ -3721,7 +3721,7 @@ int bus_exec_context_set_transient_property( STRV_FOREACH(p, l) if (!path_is_absolute(*p) || !path_is_normalized(*p) || strchr(*p, ':')) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s", name); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { if (strv_isempty(l)) { @@ -3750,13 +3750,13 @@ int bus_exec_context_set_transient_property( STRV_FOREACH(p, l) { if (!path_is_normalized(*p)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= path is not normalized: %s", name, *p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= path is not normalized: %s", name, *p); if (path_is_absolute(*p)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= path is absolute: %s", name, *p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= path is absolute: %s", name, *p); if (path_startswith(*p, "private")) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= path can't be 'private': %s", name, *p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "%s= path can't be 'private': %s", name, *p); } if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -3877,11 +3877,11 @@ int bus_exec_context_set_transient_property( while ((r = sd_bus_message_read(message, "(ssbt)", &source, &destination, &ignore_enoent, &mount_flags)) > 0) { if (!path_is_absolute(source)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not absolute.", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not absolute.", source); if (!path_is_absolute(destination)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not absolute.", destination); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not absolute.", destination); if (!IN_SET(mount_flags, 0, MS_REC)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown mount flags."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unknown mount flags."); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = bind_mount_add(&c->bind_mounts, &c->n_bind_mounts, @@ -3935,7 +3935,7 @@ int bus_exec_context_set_transient_property( while ((r = sd_bus_message_read(message, "(ss)", &path, &options)) > 0) { if (!path_is_absolute(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Mount point %s is not absolute.", path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Mount point %s is not absolute.", path); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = temporary_filesystem_add(&c->temporary_filesystems, &c->n_temporary_filesystems, path, options); @@ -4064,13 +4064,13 @@ int bus_exec_context_set_transient_property( break; if (!path_is_absolute(source)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not absolute.", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not absolute.", source); if (!path_is_normalized(source)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not normalized.", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not normalized.", source); if (!path_is_absolute(destination)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not absolute.", destination); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not absolute.", destination); if (!path_is_normalized(destination)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not normalized.", destination); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not normalized.", destination); /* Need to store them in the unit with the escapes, so that they can be parsed again */ source_escaped = shell_escape(source, ":"); @@ -4090,7 +4090,7 @@ int bus_exec_context_set_transient_property( return -ENOMEM; free_and_replace(format_str, tuple); - r = bus_read_mount_options(message, error, &options, &format_str, ":"); + r = bus_read_mount_options(message, reterr_error, &options, &format_str, ":"); if (r < 0) return r; @@ -4163,9 +4163,9 @@ int bus_exec_context_set_transient_property( break; if (!path_is_absolute(source)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not absolute.", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not absolute.", source); if (!path_is_normalized(source)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not normalized.", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not normalized.", source); /* Need to store them in the unit with the escapes, so that they can be parsed again */ source_escaped = shell_escape(source, ":"); @@ -4180,7 +4180,7 @@ int bus_exec_context_set_transient_property( return -ENOMEM; free_and_replace(format_str, tuple); - r = bus_read_mount_options(message, error, &options, &format_str, ":"); + r = bus_read_mount_options(message, reterr_error, &options, &format_str, ":"); if (r < 0) return r; @@ -4244,22 +4244,22 @@ int bus_exec_context_set_transient_property( while ((r = sd_bus_message_read(message, "(sst)", &source, &destination, &symlink_flags)) > 0) { if ((symlink_flags & ~_EXEC_DIRECTORY_FLAGS_PUBLIC) != 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid 'flags' parameter '%" PRIu64 "'", symlink_flags); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid 'flags' parameter '%" PRIu64 "'", symlink_flags); if (!path_is_valid(source)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not valid.", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not valid.", source); if (path_is_absolute(source)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is absolute.", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is absolute.", source); if (!path_is_normalized(source)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not normalized.", source); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Source path %s is not normalized.", source); if (isempty(destination)) destination = NULL; else { if (!path_is_valid(destination)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not valid.", destination); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not valid.", destination); if (path_is_absolute(destination)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is absolute.", destination); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is absolute.", destination); if (!path_is_normalized(destination)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not normalized.", destination); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Destination path %s is not normalized.", destination); } if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -4310,7 +4310,7 @@ int bus_exec_context_set_transient_property( r = image_policy_from_string(s, &p); if (r < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Failed to parse image policy string: %s", s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Failed to parse image policy string: %s", s); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *t = NULL; diff --git a/src/core/dbus-execute.h b/src/core/dbus-execute.h index 38b9c2ab0fd..fec37bd3f37 100644 --- a/src/core/dbus-execute.h +++ b/src/core/dbus-execute.h @@ -26,12 +26,65 @@ extern const sd_bus_vtable bus_exec_vtable[]; extern const sd_bus_vtable bus_unit_exec_vtable[]; -int bus_property_get_exec_output(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *ret_error); -int bus_property_get_exec_command(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *ret_error); -int bus_property_get_exec_command_list(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *ret_error); -int bus_property_get_exec_ex_command_list(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *ret_error); -int bus_property_get_exec_preserve_mode(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *ret_error); - -int bus_exec_context_set_transient_property(Unit *u, ExecContext *c, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_exec_command(Unit *u, const char *name, ExecCommand **exec_command, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_exec_preserve_mode(Unit *u, const char *name, ExecPreserveMode *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); +int bus_property_get_exec_output( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); +int bus_property_get_exec_command( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); +int bus_property_get_exec_command_list( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); +int bus_property_get_exec_ex_command_list( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); +int bus_property_get_exec_preserve_mode( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); + +int bus_exec_context_set_transient_property( + Unit *u, + ExecContext *c, + const char *name, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); +int bus_set_transient_exec_command( + Unit *u, + const char *name, + ExecCommand **exec_command, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); +int bus_set_transient_exec_preserve_mode( + Unit *u, + const char *name, + ExecPreserveMode *p, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c index 207c8b026b3..92ea7a18df4 100644 --- a/src/core/dbus-job.c +++ b/src/core/dbus-job.c @@ -27,7 +27,7 @@ static int property_get_unit( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_free_ char *p = NULL; Job *j = ASSERT_PTR(userdata); @@ -42,13 +42,13 @@ static int property_get_unit( return sd_bus_message_append(reply, "(so)", j->unit->id, p); } -int bus_job_method_cancel(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_job_method_cancel(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Job *j = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_unit_access_check(j->unit, message, "stop", error); + r = mac_selinux_unit_access_check(j->unit, message, "stop", reterr_error); if (r < 0) return r; @@ -56,7 +56,7 @@ int bus_job_method_cancel(sd_bus_message *message, void *userdata, sd_bus_error if (!sd_bus_track_contains(j->bus_track, sd_bus_message_get_sender(message))) { /* And for everybody else consult polkit */ - r = bus_verify_manage_units_async(j->manager, message, error); + r = bus_verify_manage_units_async(j->manager, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -68,7 +68,7 @@ int bus_job_method_cancel(sd_bus_message *message, void *userdata, sd_bus_error return sd_bus_reply_method_return(message, NULL); } -int bus_job_method_get_waiting_jobs(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_job_method_get_waiting_jobs(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; _cleanup_free_ Job **list = NULL; Job *j = userdata; @@ -142,7 +142,7 @@ const sd_bus_vtable bus_job_vtable[] = { SD_BUS_VTABLE_END }; -static int bus_job_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) { +static int bus_job_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); Job *j; int r; @@ -160,7 +160,7 @@ static int bus_job_find(sd_bus *bus, const char *path, const char *interface, vo return 1; } -static int bus_job_enumerate(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error) { +static int bus_job_enumerate(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **l = NULL; Manager *m = userdata; unsigned k = 0; diff --git a/src/core/dbus-job.h b/src/core/dbus-job.h index 13ce4dca758..ce3e9e42387 100644 --- a/src/core/dbus-job.h +++ b/src/core/dbus-job.h @@ -8,8 +8,8 @@ extern const sd_bus_vtable bus_job_vtable[]; extern const BusObjectImplementation job_object; -int bus_job_method_cancel(sd_bus_message *message, void *job, sd_bus_error *error); -int bus_job_method_get_waiting_jobs(sd_bus_message *message, void *userdata, sd_bus_error *error); +int bus_job_method_cancel(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_job_method_get_waiting_jobs(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); void bus_job_send_change_signal(Job *j); void bus_job_send_pending_change_signal(Job *j, bool including_new); diff --git a/src/core/dbus-kill.c b/src/core/dbus-kill.c index 12dea8fb3b0..22a5b278cc8 100644 --- a/src/core/dbus-kill.c +++ b/src/core/dbus-kill.c @@ -16,7 +16,7 @@ static int property_get_restart_kill_signal( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { KillContext *c = ASSERT_PTR(userdata); int s; @@ -48,7 +48,7 @@ int bus_kill_context_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { assert(u); assert(c); @@ -58,25 +58,25 @@ int bus_kill_context_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "KillMode")) - return bus_set_transient_kill_mode(u, name, &c->kill_mode, message, flags, error); + return bus_set_transient_kill_mode(u, name, &c->kill_mode, message, flags, reterr_error); if (streq(name, "SendSIGHUP")) - return bus_set_transient_bool(u, name, &c->send_sighup, message, flags, error); + return bus_set_transient_bool(u, name, &c->send_sighup, message, flags, reterr_error); if (streq(name, "SendSIGKILL")) - return bus_set_transient_bool(u, name, &c->send_sigkill, message, flags, error); + return bus_set_transient_bool(u, name, &c->send_sigkill, message, flags, reterr_error); if (streq(name, "KillSignal")) - return bus_set_transient_kill_signal(u, name, &c->kill_signal, message, flags, error); + return bus_set_transient_kill_signal(u, name, &c->kill_signal, message, flags, reterr_error); if (streq(name, "RestartKillSignal")) - return bus_set_transient_restart_kill_signal(u, name, &c->restart_kill_signal, message, flags, error); + return bus_set_transient_restart_kill_signal(u, name, &c->restart_kill_signal, message, flags, reterr_error); if (streq(name, "FinalKillSignal")) - return bus_set_transient_final_kill_signal(u, name, &c->final_kill_signal, message, flags, error); + return bus_set_transient_final_kill_signal(u, name, &c->final_kill_signal, message, flags, reterr_error); if (streq(name, "WatchdogSignal")) - return bus_set_transient_watchdog_signal(u, name, &c->watchdog_signal, message, flags, error); + return bus_set_transient_watchdog_signal(u, name, &c->watchdog_signal, message, flags, reterr_error); return 0; } diff --git a/src/core/dbus-kill.h b/src/core/dbus-kill.h index 6afe40e58b2..8d5d0c5a13b 100644 --- a/src/core/dbus-kill.h +++ b/src/core/dbus-kill.h @@ -7,4 +7,10 @@ extern const sd_bus_vtable bus_kill_vtable[]; -int bus_kill_context_set_transient_property(Unit *u, KillContext *c, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); +int bus_kill_context_set_transient_property( + Unit *u, + KillContext *c, + const char *name, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 5d2c0c19721..e97b36e5d3c 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -82,7 +82,7 @@ static int property_get_virtualization( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Virtualization v; @@ -108,7 +108,7 @@ static int property_get_confidential_virtualization( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ConfidentialVirtualization v; @@ -129,7 +129,7 @@ static int property_get_tainted( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { assert(bus); assert(reply); @@ -148,7 +148,7 @@ static int property_set_log_target( const char *property, sd_bus_message *value, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = userdata; const char *t; @@ -168,7 +168,7 @@ static int property_set_log_target( target = log_target_from_string(t); if (target < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid log target '%s'", t); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid log target '%s'", t); manager_override_log_target(m, target); } @@ -183,7 +183,7 @@ static int property_set_log_level( const char *property, sd_bus_message *value, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = userdata; const char *t; @@ -203,7 +203,7 @@ static int property_set_log_level( level = log_level_from_string(t); if (level < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid log level '%s'", t); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid log level '%s'", t); manager_override_log_level(m, level); } @@ -218,7 +218,7 @@ static int property_get_environment( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_strv_free_ char **l = NULL; Manager *m = ASSERT_PTR(userdata); @@ -241,7 +241,7 @@ static int property_get_show_status( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); @@ -258,7 +258,7 @@ static int property_get_runtime_watchdog( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); @@ -275,7 +275,7 @@ static int property_get_pretimeout_watchdog( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); @@ -292,7 +292,7 @@ static int property_get_pretimeout_watchdog_governor( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); @@ -309,7 +309,7 @@ static int property_get_reboot_watchdog( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); @@ -326,7 +326,7 @@ static int property_get_kexec_watchdog( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); @@ -360,7 +360,7 @@ static int property_set_runtime_watchdog( const char *property, sd_bus_message *value, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { return property_set_watchdog(userdata, WATCHDOG_RUNTIME, value); } @@ -372,7 +372,7 @@ static int property_set_pretimeout_watchdog( const char *property, sd_bus_message *value, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { return property_set_watchdog(userdata, WATCHDOG_PRETIMEOUT, value); } @@ -384,7 +384,7 @@ static int property_set_pretimeout_watchdog_governor( const char *property, sd_bus_message *value, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); char *governor; @@ -406,7 +406,7 @@ static int property_set_reboot_watchdog( const char *property, sd_bus_message *value, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { return property_set_watchdog(userdata, WATCHDOG_REBOOT, value); } @@ -418,7 +418,7 @@ static int property_set_kexec_watchdog( const char *property, sd_bus_message *value, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _unused_ Manager *m = ASSERT_PTR(userdata); @@ -435,7 +435,7 @@ static int property_get_oom_score_adjust( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r, n; @@ -462,7 +462,7 @@ static int property_get_transactions_with_cycle( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; @@ -484,7 +484,7 @@ static int property_get_transactions_with_cycle( return sd_bus_message_close_container(reply); } -static int bus_get_unit_by_name(Manager *m, sd_bus_message *message, const char *name, Unit **ret_unit, sd_bus_error *error) { +static int bus_get_unit_by_name(Manager *m, sd_bus_message *message, const char *name, Unit **ret_unit, sd_bus_error *reterr_error) { Unit *u; int r; @@ -504,18 +504,18 @@ static int bus_get_unit_by_name(Manager *m, sd_bus_message *message, const char u = manager_get_unit_by_pidref(m, &pidref); if (!u) - return sd_bus_error_set(error, BUS_ERROR_NO_SUCH_UNIT, "Client not member of any unit."); + return sd_bus_error_set(reterr_error, BUS_ERROR_NO_SUCH_UNIT, "Client not member of any unit."); } else { u = manager_get_unit(m, name); if (!u) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s not loaded.", name); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s not loaded.", name); } *ret_unit = u; return 0; } -static int bus_load_unit_by_name(Manager *m, sd_bus_message *message, const char *name, Unit **ret_unit, sd_bus_error *error) { +static int bus_load_unit_by_name(Manager *m, sd_bus_message *message, const char *name, Unit **ret_unit, sd_bus_error *reterr_error) { assert(m); assert(message); assert(ret_unit); @@ -523,19 +523,19 @@ static int bus_load_unit_by_name(Manager *m, sd_bus_message *message, const char /* Pretty much the same as bus_get_unit_by_name(), but we also load the unit if necessary. */ if (isempty(name)) - return bus_get_unit_by_name(m, message, name, ret_unit, error); + return bus_get_unit_by_name(m, message, name, ret_unit, reterr_error); - return manager_load_unit(m, name, NULL, error, ret_unit); + return manager_load_unit(m, name, NULL, reterr_error, ret_unit); } -static int reply_unit_path(Unit *u, sd_bus_message *message, sd_bus_error *error) { +static int reply_unit_path(Unit *u, sd_bus_message *message, sd_bus_error *reterr_error) { _cleanup_free_ char *path = NULL; int r; assert(u); assert(message); - r = mac_selinux_unit_access_check(u, message, "status", error); + r = mac_selinux_unit_access_check(u, message, "status", reterr_error); if (r < 0) return r; @@ -546,7 +546,7 @@ static int reply_unit_path(Unit *u, sd_bus_message *message, sd_bus_error *error return sd_bus_reply_method_return(message, "o", path); } -static int method_get_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); const char *name; Unit *u; @@ -560,14 +560,14 @@ static int method_get_unit(sd_bus_message *message, void *userdata, sd_bus_error if (r < 0) return r; - r = bus_get_unit_by_name(m, message, name, &u, error); + r = bus_get_unit_by_name(m, message, name, &u, reterr_error); if (r < 0) return r; - return reply_unit_path(u, message, error); + return reply_unit_path(u, message, reterr_error); } -static int method_get_unit_by_pid(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_unit_by_pid(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); _cleanup_(pidref_done) PidRef pidref = PIDREF_NULL; Unit *u; @@ -583,7 +583,7 @@ static int method_get_unit_by_pid(sd_bus_message *message, void *userdata, sd_bu if (r < 0) return r; if (pidref.pid < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid PID " PID_FMT, pidref.pid); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid PID " PID_FMT, pidref.pid); if (pidref.pid == 0) { r = bus_query_sender_pidref(message, &pidref); if (r < 0) @@ -592,12 +592,12 @@ static int method_get_unit_by_pid(sd_bus_message *message, void *userdata, sd_bu u = manager_get_unit_by_pidref(m, &pidref); if (!u) - return sd_bus_error_setf(error, BUS_ERROR_NO_UNIT_FOR_PID, "PID "PID_FMT" does not belong to any loaded unit.", pidref.pid); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_UNIT_FOR_PID, "PID "PID_FMT" does not belong to any loaded unit.", pidref.pid); - return reply_unit_path(u, message, error); + return reply_unit_path(u, message, reterr_error); } -static int method_get_unit_by_invocation_id(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_unit_by_invocation_id(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_free_ char *path = NULL; Manager *m = ASSERT_PTR(userdata); sd_id128_t id; @@ -609,7 +609,7 @@ static int method_get_unit_by_invocation_id(sd_bus_message *message, void *userd /* Anyone can call this method */ if (bus_message_read_id128(message, &id) < 0) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid invocation ID"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid invocation ID"); if (sd_id128_is_null(id)) { _cleanup_(pidref_done) PidRef pidref = PIDREF_NULL; @@ -620,15 +620,15 @@ static int method_get_unit_by_invocation_id(sd_bus_message *message, void *userd u = manager_get_unit_by_pidref(m, &pidref); if (!u) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_UNIT, "Client " PID_FMT " not member of any unit.", pidref.pid); } else { u = hashmap_get(m->units_by_invocation_id, &id); if (!u) - return sd_bus_error_setf(error, BUS_ERROR_NO_UNIT_FOR_INVOCATION_ID, "No unit with the specified invocation ID " SD_ID128_FORMAT_STR " known.", SD_ID128_FORMAT_VAL(id)); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_UNIT_FOR_INVOCATION_ID, "No unit with the specified invocation ID " SD_ID128_FORMAT_STR " known.", SD_ID128_FORMAT_VAL(id)); } - r = mac_selinux_unit_access_check(u, message, "status", error); + r = mac_selinux_unit_access_check(u, message, "status", reterr_error); if (r < 0) return r; @@ -642,7 +642,7 @@ static int method_get_unit_by_invocation_id(sd_bus_message *message, void *userd return sd_bus_reply_method_return(message, "o", path); } -static int method_get_unit_by_control_group(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_unit_by_control_group(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = userdata; const char *cgroup; Unit *u; @@ -654,14 +654,14 @@ static int method_get_unit_by_control_group(sd_bus_message *message, void *userd u = manager_get_unit_by_cgroup(m, cgroup); if (!u) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_UNIT, "Control group '%s' is not valid or not managed by this instance", cgroup); - return reply_unit_path(u, message, error); + return reply_unit_path(u, message, reterr_error); } -static int method_get_unit_by_pidfd(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_unit_by_pidfd(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; _cleanup_(pidref_done) PidRef pidref = PIDREF_NULL; Manager *m = ASSERT_PTR(userdata); @@ -677,13 +677,13 @@ static int method_get_unit_by_pidfd(sd_bus_message *message, void *userdata, sd_ r = pidref_set_pidfd(&pidref, pidfd); if (r < 0) - return sd_bus_error_set_errnof(error, r, "Failed to get PID from PIDFD: %m"); + return sd_bus_error_set_errnof(reterr_error, r, "Failed to get PID from PIDFD: %m"); u = manager_get_unit_by_pidref(m, &pidref); if (!u) - return sd_bus_error_setf(error, BUS_ERROR_NO_UNIT_FOR_PID, "PID "PID_FMT" does not belong to any loaded unit.", pidref.pid); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_UNIT_FOR_PID, "PID "PID_FMT" does not belong to any loaded unit.", pidref.pid); - r = mac_selinux_unit_access_check(u, message, "status", error); + r = mac_selinux_unit_access_check(u, message, "status", reterr_error); if (r < 0) return r; @@ -707,17 +707,17 @@ static int method_get_unit_by_pidfd(sd_bus_message *message, void *userdata, sd_ * answer. */ r = pidref_verify(&pidref); if (r == -ESRCH) - return sd_bus_error_setf(error, + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_PROCESS, "The PIDFD's PID "PID_FMT" changed during the lookup operation.", pidref.pid); if (r < 0) - return sd_bus_error_set_errnof(error, r, "Failed to get PID from PIDFD: %m"); + return sd_bus_error_set_errnof(reterr_error, r, "Failed to get PID from PIDFD: %m"); return sd_bus_message_send(reply); } -static int method_load_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_load_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); const char *name; Unit *u; @@ -731,14 +731,14 @@ static int method_load_unit(sd_bus_message *message, void *userdata, sd_bus_erro if (r < 0) return r; - r = bus_load_unit_by_name(m, message, name, &u, error); + r = bus_load_unit_by_name(m, message, name, &u, reterr_error); if (r < 0) return r; - return reply_unit_path(u, message, error); + return reply_unit_path(u, message, reterr_error); } -static int method_start_unit_generic(sd_bus_message *message, Manager *m, JobType job_type, bool reload_if_possible, sd_bus_error *error) { +static int method_start_unit_generic(sd_bus_message *message, Manager *m, JobType job_type, bool reload_if_possible, sd_bus_error *reterr_error) { const char *name; Unit *u; int r; @@ -750,39 +750,39 @@ static int method_start_unit_generic(sd_bus_message *message, Manager *m, JobTyp if (r < 0) return r; - r = manager_load_unit(m, name, NULL, error, &u); + r = manager_load_unit(m, name, NULL, reterr_error, &u); if (r < 0) return r; - return bus_unit_method_start_generic(message, u, job_type, reload_if_possible, error); + return bus_unit_method_start_generic(message, u, job_type, reload_if_possible, reterr_error); } -static int method_start_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_start_unit_generic(message, userdata, JOB_START, /* reload_if_possible = */ false, error); +static int method_start_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_start_unit_generic(message, userdata, JOB_START, /* reload_if_possible = */ false, reterr_error); } -static int method_stop_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_start_unit_generic(message, userdata, JOB_STOP, /* reload_if_possible = */ false, error); +static int method_stop_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_start_unit_generic(message, userdata, JOB_STOP, /* reload_if_possible = */ false, reterr_error); } -static int method_reload_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_start_unit_generic(message, userdata, JOB_RELOAD, /* reload_if_possible = */ false, error); +static int method_reload_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_start_unit_generic(message, userdata, JOB_RELOAD, /* reload_if_possible = */ false, reterr_error); } -static int method_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_start_unit_generic(message, userdata, JOB_RESTART, /* reload_if_possible = */ false, error); +static int method_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_start_unit_generic(message, userdata, JOB_RESTART, /* reload_if_possible = */ false, reterr_error); } -static int method_try_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, /* reload_if_possible = */ false, error); +static int method_try_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, /* reload_if_possible = */ false, reterr_error); } -static int method_reload_or_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_start_unit_generic(message, userdata, JOB_RESTART, /* reload_if_possible = */ true, error); +static int method_reload_or_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_start_unit_generic(message, userdata, JOB_RESTART, /* reload_if_possible = */ true, reterr_error); } -static int method_reload_or_try_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, /* reload_if_possible = */ true, error); +static int method_reload_or_try_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, /* reload_if_possible = */ true, reterr_error); } typedef enum GenericUnitOperationFlags { @@ -793,7 +793,7 @@ typedef enum GenericUnitOperationFlags { static int method_generic_unit_operation( sd_bus_message *message, Manager *m, - sd_bus_error *error, + sd_bus_error *reterr_error, UnitType type, sd_bus_message_handler_t handler, GenericUnitOperationFlags flags) { @@ -814,32 +814,32 @@ static int method_generic_unit_operation( return r; if (!isempty(name) && FLAGS_SET(flags, GENERIC_UNIT_LOAD)) - r = manager_load_unit(m, name, NULL, error, &u); + r = manager_load_unit(m, name, NULL, reterr_error, &u); else - r = bus_get_unit_by_name(m, message, name, &u, error); + r = bus_get_unit_by_name(m, message, name, &u, reterr_error); if (r < 0) return r; if (type != _UNIT_TYPE_INVALID && u->type != type) - return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "%s operation is not supported for unit type '%s'", sd_bus_message_get_member(message), unit_type_to_string(u->type)); if (FLAGS_SET(flags, GENERIC_UNIT_VALIDATE_LOADED)) { - r = bus_unit_validate_load_state(u, error); + r = bus_unit_validate_load_state(u, reterr_error); if (r < 0) return r; } - return handler(message, u, error); + return handler(message, u, reterr_error); } -static int method_enqueue_unit_job(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_enqueue_unit_job(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* We don't bother with GENERIC_UNIT_VALIDATE_LOADED here, as the job logic validates that anyway */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_enqueue_job, GENERIC_UNIT_LOAD); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_enqueue_job, GENERIC_UNIT_LOAD); } -static int method_start_unit_replace(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_start_unit_replace(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); const char *old_name; Unit *u; @@ -851,73 +851,73 @@ static int method_start_unit_replace(sd_bus_message *message, void *userdata, sd if (r < 0) return r; - r = bus_get_unit_by_name(m, message, old_name, &u, error); + r = bus_get_unit_by_name(m, message, old_name, &u, reterr_error); if (r < 0) return r; if (!u->job || u->job->type != JOB_START) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "No job queued for unit %s", old_name); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_JOB, "No job queued for unit %s", old_name); - return method_start_unit_generic(message, m, JOB_START, /* reload_if_possible = */ false, error); + return method_start_unit_generic(message, m, JOB_START, /* reload_if_possible = */ false, reterr_error); } -static int method_kill_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_kill_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* We don't bother with GENERIC_UNIT_LOAD or GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't * matter whether a unit is loaded for killing any processes in the unit's cgroup. */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_kill, /* flags = */ 0); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_kill, /* flags = */ 0); } -static int method_kill_unit_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_kill_unit_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* We don't bother with GENERIC_UNIT_LOAD or GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't * matter whether a unit is loaded for killing any processes in the unit's cgroup. */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_kill_subgroup, /* flags = */ 0); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_kill_subgroup, /* flags = */ 0); } -static int method_clean_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_clean_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Load the unit if necessary, in order to load it, and insist on the unit being loaded to be * cleaned */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_clean, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_clean, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED); } -static int method_freeze_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_freeze_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Only active units can be frozen, which must be properly loaded already */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_freeze, GENERIC_UNIT_VALIDATE_LOADED); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_freeze, GENERIC_UNIT_VALIDATE_LOADED); } -static int method_thaw_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_thaw_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Same as freeze above */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_thaw, GENERIC_UNIT_VALIDATE_LOADED); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_thaw, GENERIC_UNIT_VALIDATE_LOADED); } -static int method_reset_failed_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_reset_failed_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Don't load the unit (because unloaded units can't be in failed state), and don't insist on the * unit to be loaded properly (since a failed unit might have its unit file disappeared) */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_reset_failed, /* flags = */ 0); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_reset_failed, /* flags = */ 0); } -static int method_set_unit_properties(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_set_unit_properties(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Only change properties on fully loaded units, and load them in order to set properties */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_set_properties, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_set_properties, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED); } -static int method_bind_mount_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_bind_mount_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Only add mounts on fully loaded units */ - return method_generic_unit_operation(message, userdata, error, UNIT_SERVICE, bus_service_method_bind_mount, GENERIC_UNIT_VALIDATE_LOADED); + return method_generic_unit_operation(message, userdata, reterr_error, UNIT_SERVICE, bus_service_method_bind_mount, GENERIC_UNIT_VALIDATE_LOADED); } -static int method_mount_image_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_mount_image_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Only add mounts on fully loaded units */ - return method_generic_unit_operation(message, userdata, error, UNIT_SERVICE, bus_service_method_mount_image, GENERIC_UNIT_VALIDATE_LOADED); + return method_generic_unit_operation(message, userdata, reterr_error, UNIT_SERVICE, bus_service_method_mount_image, GENERIC_UNIT_VALIDATE_LOADED); } -static int method_ref_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_ref_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Only allow reffing of fully loaded units, and make sure reffing a unit loads it. */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_ref, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_ref, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED); } -static int method_unref_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_unref_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Dropping a ref OTOH should not require the unit to still be loaded. And since a reffed unit is a * loaded unit there's no need to load the unit for unreffing it. */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_unref, /* flags = */ 0); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_unref, /* flags = */ 0); } static int reply_unit_info(sd_bus_message *reply, Unit *u) { @@ -950,7 +950,7 @@ static int reply_unit_info(sd_bus_message *reply, Unit *u) { empty_to_root(job_path)); } -static int method_list_units_by_names(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_list_units_by_names(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; Manager *m = ASSERT_PTR(userdata); int r; @@ -976,7 +976,7 @@ static int method_list_units_by_names(sd_bus_message *message, void *userdata, s if (!unit_name_is_valid(*unit, UNIT_NAME_ANY)) continue; - r = bus_load_unit_by_name(m, message, *unit, &u, error); + r = bus_load_unit_by_name(m, message, *unit, &u, reterr_error); if (r < 0) return r; @@ -992,24 +992,24 @@ static int method_list_units_by_names(sd_bus_message *message, void *userdata, s return sd_bus_message_send(reply); } -static int method_get_unit_processes(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_unit_processes(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Don't load a unit actively (since it won't have any processes if it's not loaded), but don't * insist on the unit being loaded either (because even improperly loaded units might still have * processes around). */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_get_processes, /* flags = */ 0); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_get_processes, /* flags = */ 0); } -static int method_attach_processes_to_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_attach_processes_to_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Don't allow attaching new processes to units that aren't loaded. Don't bother with loading a unit * for this purpose though, as an unloaded unit is a stopped unit, and we don't allow attaching * processes to stopped units anyway. */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_attach_processes, GENERIC_UNIT_VALIDATE_LOADED); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_attach_processes, GENERIC_UNIT_VALIDATE_LOADED); } -static int method_remove_subgroup_from_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_remove_subgroup_from_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { /* Don't allow removal of subgroups from units that aren't loaded. But allow loading the unit, since * this is clean-up work, that is OK to do when the unit is stopped already. */ - return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_remove_subgroup, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED); + return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_remove_subgroup, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED); } static int transient_unit_from_message( @@ -1017,7 +1017,7 @@ static int transient_unit_from_message( sd_bus_message *message, const char *name, Unit **ret_unit, - sd_bus_error *error) { + sd_bus_error *reterr_error) { UnitType t; Unit *u; @@ -1029,20 +1029,20 @@ static int transient_unit_from_message( t = unit_name_to_type(name); if (t < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit name or type: %s", name); if (!unit_vtable[t]->can_transient) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unit type %s does not support transient units.", unit_type_to_string(t)); - r = manager_load_unit(m, name, NULL, error, &u); + r = manager_load_unit(m, name, NULL, reterr_error, &u); if (r < 0) return r; if (!unit_is_pristine(u)) - return sd_bus_error_setf(error, BUS_ERROR_UNIT_EXISTS, + return sd_bus_error_setf(reterr_error, BUS_ERROR_UNIT_EXISTS, "Unit %s was already loaded or has a fragment file.", name); /* OK, the unit failed to load and is unreferenced, now let's @@ -1052,7 +1052,7 @@ static int transient_unit_from_message( return r; /* Set our properties */ - r = bus_unit_set_properties(u, message, UNIT_RUNTIME, false, error); + r = bus_unit_set_properties(u, message, UNIT_RUNTIME, false, reterr_error); if (r < 0) return r; @@ -1076,7 +1076,7 @@ static int transient_unit_from_message( static int transient_aux_units_from_message( Manager *m, sd_bus_message *message, - sd_bus_error *error) { + sd_bus_error *reterr_error) { int r; @@ -1094,7 +1094,7 @@ static int transient_aux_units_from_message( if (r < 0) return r; - r = transient_unit_from_message(m, message, name, /* ret_unit = */ NULL, error); + r = transient_unit_from_message(m, message, name, /* ret_unit = */ NULL, reterr_error); if (r < 0) return r; @@ -1112,7 +1112,7 @@ static int transient_aux_units_from_message( return 0; } -static int method_start_transient_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_start_transient_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { const char *name, *smode; Manager *m = ASSERT_PTR(userdata); JobMode mode; @@ -1121,7 +1121,7 @@ static int method_start_transient_unit(sd_bus_message *message, void *userdata, assert(message); - r = mac_selinux_access_check(message, "start", error); + r = mac_selinux_access_check(message, "start", reterr_error); if (r < 0) return r; @@ -1131,7 +1131,7 @@ static int method_start_transient_unit(sd_bus_message *message, void *userdata, mode = job_mode_from_string(smode); if (mode < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s is invalid.", smode); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s is invalid.", smode); r = bus_verify_manage_units_async_impl( m, @@ -1139,25 +1139,25 @@ static int method_start_transient_unit(sd_bus_message *message, void *userdata, "start", N_("Authentication is required to start transient unit '$(unit)'."), message, - error); + reterr_error); if (r < 0) return r; if (r == 0) return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ - r = transient_unit_from_message(m, message, name, &u, error); + r = transient_unit_from_message(m, message, name, &u, reterr_error); if (r < 0) return r; - r = transient_aux_units_from_message(m, message, error); + r = transient_aux_units_from_message(m, message, reterr_error); if (r < 0) return r; /* Finally, start it */ - return bus_unit_queue_job(message, u, JOB_START, mode, 0, error); + return bus_unit_queue_job(message, u, JOB_START, mode, 0, reterr_error); } -static int method_get_job(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_job(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_free_ char *path = NULL; Manager *m = ASSERT_PTR(userdata); uint32_t id; @@ -1174,9 +1174,9 @@ static int method_get_job(sd_bus_message *message, void *userdata, sd_bus_error j = manager_get_job(m, id); if (!j) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id); - r = mac_selinux_unit_access_check(j->unit, message, "status", error); + r = mac_selinux_unit_access_check(j->unit, message, "status", reterr_error); if (r < 0) return r; @@ -1187,7 +1187,7 @@ static int method_get_job(sd_bus_message *message, void *userdata, sd_bus_error return sd_bus_reply_method_return(message, "o", path); } -static int method_cancel_job(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_cancel_job(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); uint32_t id; Job *j; @@ -1201,22 +1201,22 @@ static int method_cancel_job(sd_bus_message *message, void *userdata, sd_bus_err j = manager_get_job(m, id); if (!j) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id); - return bus_job_method_cancel(message, j, error); + return bus_job_method_cancel(message, j, reterr_error); } -static int method_clear_jobs(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_clear_jobs(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_access_check(message, "reload", error); + r = mac_selinux_access_check(message, "reload", reterr_error); if (r < 0) return r; - r = bus_verify_manage_units_async(m, message, error); + r = bus_verify_manage_units_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -1227,17 +1227,17 @@ static int method_clear_jobs(sd_bus_message *message, void *userdata, sd_bus_err return sd_bus_reply_method_return(message, NULL); } -static int method_reset_failed(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_reset_failed(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_access_check(message, "reload", error); + r = mac_selinux_access_check(message, "reload", reterr_error); if (r < 0) return r; - r = bus_verify_manage_units_async(m, message, error); + r = bus_verify_manage_units_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -1248,7 +1248,7 @@ static int method_reset_failed(sd_bus_message *message, void *userdata, sd_bus_e return sd_bus_reply_method_return(message, NULL); } -static int list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_error *error, char **states, char **patterns) { +static int list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error, char **states, char **patterns) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; Manager *m = ASSERT_PTR(userdata); const char *k; @@ -1259,7 +1259,7 @@ static int list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_e /* Anyone can call this method */ - r = mac_selinux_access_check(message, "status", error); + r = mac_selinux_access_check(message, "status", reterr_error); if (r < 0) return r; @@ -1290,11 +1290,11 @@ static int list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_e return sd_bus_message_send(reply); } -static int method_list_units(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return list_units_filtered(message, userdata, error, NULL, NULL); +static int method_list_units(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return list_units_filtered(message, userdata, reterr_error, NULL, NULL); } -static int method_list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **states = NULL; int r; @@ -1302,10 +1302,10 @@ static int method_list_units_filtered(sd_bus_message *message, void *userdata, s if (r < 0) return r; - return list_units_filtered(message, userdata, error, states, NULL); + return list_units_filtered(message, userdata, reterr_error, states, NULL); } -static int method_list_units_by_patterns(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_list_units_by_patterns(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **states = NULL; _cleanup_strv_free_ char **patterns = NULL; int r; @@ -1318,10 +1318,10 @@ static int method_list_units_by_patterns(sd_bus_message *message, void *userdata if (r < 0) return r; - return list_units_filtered(message, userdata, error, states, patterns); + return list_units_filtered(message, userdata, reterr_error, states, patterns); } -static int method_list_jobs(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_list_jobs(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; Manager *m = ASSERT_PTR(userdata); Job *j; @@ -1331,7 +1331,7 @@ static int method_list_jobs(sd_bus_message *message, void *userdata, sd_bus_erro /* Anyone can call this method */ - r = mac_selinux_access_check(message, "status", error); + r = mac_selinux_access_check(message, "status", reterr_error); if (r < 0) return r; @@ -1373,7 +1373,7 @@ static int method_list_jobs(sd_bus_message *message, void *userdata, sd_bus_erro return sd_bus_message_send(reply); } -static int method_subscribe(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_subscribe(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; @@ -1381,7 +1381,7 @@ static int method_subscribe(sd_bus_message *message, void *userdata, sd_bus_erro /* Anyone can call this method */ - r = mac_selinux_access_check(message, "status", error); + r = mac_selinux_access_check(message, "status", reterr_error); if (r < 0) return r; @@ -1400,13 +1400,13 @@ static int method_subscribe(sd_bus_message *message, void *userdata, sd_bus_erro if (r < 0) return r; if (r == 0) - return sd_bus_error_set(error, BUS_ERROR_ALREADY_SUBSCRIBED, "Client is already subscribed."); + return sd_bus_error_set(reterr_error, BUS_ERROR_ALREADY_SUBSCRIBED, "Client is already subscribed."); } return sd_bus_reply_method_return(message, NULL); } -static int method_unsubscribe(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_unsubscribe(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; @@ -1414,7 +1414,7 @@ static int method_unsubscribe(sd_bus_message *message, void *userdata, sd_bus_er /* Anyone can call this method */ - r = mac_selinux_access_check(message, "status", error); + r = mac_selinux_access_check(message, "status", reterr_error); if (r < 0) return r; @@ -1423,7 +1423,7 @@ static int method_unsubscribe(sd_bus_message *message, void *userdata, sd_bus_er if (r < 0) return r; if (r == 0) - return sd_bus_error_set(error, BUS_ERROR_NOT_SUBSCRIBED, "Client is not subscribed."); + return sd_bus_error_set(reterr_error, BUS_ERROR_NOT_SUBSCRIBED, "Client is not subscribed."); } return sd_bus_reply_method_return(message, NULL); @@ -1432,7 +1432,7 @@ static int method_unsubscribe(sd_bus_message *message, void *userdata, sd_bus_er static int dump_impl( sd_bus_message *message, void *userdata, - sd_bus_error *error, + sd_bus_error *reterr_error, char **patterns, int (*reply)(sd_bus_message *, char *)) { @@ -1444,7 +1444,7 @@ static int dump_impl( /* 'status' access is the bare minimum always needed for this, as the policy might straight out * forbid a client from querying any information from systemd, regardless of any rate limiting. */ - r = mac_selinux_access_check(message, "status", error); + r = mac_selinux_access_check(message, "status", reterr_error); if (r < 0) return r; @@ -1461,7 +1461,7 @@ static int dump_impl( if (r < 0) goto ratelimited; - r = bus_verify_bypass_dump_ratelimit_async(m, message, /* error = */ NULL); + r = bus_verify_bypass_dump_ratelimit_async(m, message, /* reterr_error = */ NULL); if (r < 0) goto ratelimited; if (r == 0) @@ -1479,7 +1479,7 @@ static int dump_impl( ratelimited: log_warning("Dump request rejected due to rate limit on unprivileged callers, blocked for %s.", FORMAT_TIMESPAN(ratelimit_left(&m->dump_ratelimit), USEC_PER_SEC)); - return sd_bus_error_setf(error, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_LIMITS_EXCEEDED, "Dump request rejected due to rate limit on unprivileged callers, blocked for %s.", FORMAT_TIMESPAN(ratelimit_left(&m->dump_ratelimit), USEC_PER_SEC)); @@ -1489,8 +1489,8 @@ static int reply_dump(sd_bus_message *message, char *dump) { return sd_bus_reply_method_return(message, "s", dump); } -static int method_dump(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return dump_impl(message, userdata, error, NULL, reply_dump); +static int method_dump(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return dump_impl(message, userdata, reterr_error, NULL, reply_dump); } static int reply_dump_by_fd(sd_bus_message *message, char *dump) { @@ -1503,14 +1503,14 @@ static int reply_dump_by_fd(sd_bus_message *message, char *dump) { return sd_bus_reply_method_return(message, "h", fd); } -static int method_dump_by_fd(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return dump_impl(message, userdata, error, NULL, reply_dump_by_fd); +static int method_dump_by_fd(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return dump_impl(message, userdata, reterr_error, NULL, reply_dump_by_fd); } static int dump_units_matching_patterns( sd_bus_message *message, void *userdata, - sd_bus_error *error, + sd_bus_error *reterr_error, int (*reply)(sd_bus_message *, char *)) { _cleanup_strv_free_ char **patterns = NULL; int r; @@ -1519,19 +1519,19 @@ static int dump_units_matching_patterns( if (r < 0) return r; - return dump_impl(message, userdata, error, patterns, reply); + return dump_impl(message, userdata, reterr_error, patterns, reply); } -static int method_dump_units_matching_patterns(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return dump_units_matching_patterns(message, userdata, error, reply_dump); +static int method_dump_units_matching_patterns(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return dump_units_matching_patterns(message, userdata, reterr_error, reply_dump); } -static int method_dump_units_matching_patterns_by_fd(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return dump_units_matching_patterns(message, userdata, error, reply_dump_by_fd); +static int method_dump_units_matching_patterns_by_fd(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return dump_units_matching_patterns(message, userdata, reterr_error, reply_dump_by_fd); } -static int method_refuse_snapshot(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "Support for snapshots has been removed."); +static int method_refuse_snapshot(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Support for snapshots has been removed."); } static void log_caller(sd_bus_message *message, Manager *manager, const char *method) { @@ -1552,17 +1552,17 @@ static void log_caller(sd_bus_message *message, Manager *manager, const char *me manager_log_caller(manager, &pidref, method); } -static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_access_check(message, "reload", error); + r = mac_selinux_access_check(message, "reload", reterr_error); if (r < 0) return r; - r = bus_verify_reload_daemon_async(m, message, error); + r = bus_verify_reload_daemon_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -1574,7 +1574,7 @@ static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error * /* Check the rate limit after the authorization succeeds, to avoid denial-of-service issues. */ if (!ratelimit_below(&m->reload_reexec_ratelimit)) { log_warning("Reloading request rejected due to rate limit."); - return sd_bus_error_set(error, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_LIMITS_EXCEEDED, "Reload() request rejected due to rate limit."); } @@ -1595,17 +1595,17 @@ static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error * return 1; } -static int method_reexecute(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_reexecute(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_access_check(message, "reload", error); + r = mac_selinux_access_check(message, "reload", reterr_error); if (r < 0) return r; - r = bus_verify_reload_daemon_async(m, message, error); + r = bus_verify_reload_daemon_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -1617,7 +1617,7 @@ static int method_reexecute(sd_bus_message *message, void *userdata, sd_bus_erro /* Check the rate limit after the authorization succeeds, to avoid denial-of-service issues. */ if (!ratelimit_below(&m->reload_reexec_ratelimit)) { log_warning("Reexecution request rejected due to rate limit."); - return sd_bus_error_set(error, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_LIMITS_EXCEEDED, "Reexecute() request rejected due to rate limit."); } @@ -1629,13 +1629,13 @@ static int method_reexecute(sd_bus_message *message, void *userdata, sd_bus_erro return 1; } -static int method_exit(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_exit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_access_check(message, "halt", error); + r = mac_selinux_access_check(message, "halt", reterr_error); if (r < 0) return r; @@ -1651,17 +1651,17 @@ static int method_exit(sd_bus_message *message, void *userdata, sd_bus_error *er return sd_bus_reply_method_return(message, NULL); } -static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); if (!MANAGER_IS_SYSTEM(m)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Reboot is only supported by system manager."); - r = mac_selinux_access_check(message, "reboot", error); + r = mac_selinux_access_check(message, "reboot", reterr_error); if (r < 0) return r; @@ -1672,7 +1672,7 @@ static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error * return sd_bus_reply_method_return(message, NULL); } -static int method_soft_reboot(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_soft_reboot(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); _cleanup_free_ char *rt = NULL; const char *root; @@ -1681,10 +1681,10 @@ static int method_soft_reboot(sd_bus_message *message, void *userdata, sd_bus_er assert(message); if (!MANAGER_IS_SYSTEM(m)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Soft reboot is only supported by system manager."); - r = mac_selinux_access_check(message, "reboot", error); + r = mac_selinux_access_check(message, "reboot", reterr_error); if (r < 0) return r; @@ -1694,10 +1694,10 @@ static int method_soft_reboot(sd_bus_message *message, void *userdata, sd_bus_er if (!isempty(root)) { if (!path_is_valid(root)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "New root directory '%s' must be a valid path.", root); if (!path_is_absolute(root)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "New root directory path '%s' is not absolute.", root); r = path_simplify_alloc(root, &rt); @@ -1713,17 +1713,17 @@ static int method_soft_reboot(sd_bus_message *message, void *userdata, sd_bus_er return sd_bus_reply_method_return(message, NULL); } -static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); if (!MANAGER_IS_SYSTEM(m)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Powering off is only supported by system manager."); - r = mac_selinux_access_check(message, "halt", error); + r = mac_selinux_access_check(message, "halt", reterr_error); if (r < 0) return r; @@ -1734,17 +1734,17 @@ static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error return sd_bus_reply_method_return(message, NULL); } -static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); if (!MANAGER_IS_SYSTEM(m)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Halt is only supported by system manager."); - r = mac_selinux_access_check(message, "halt", error); + r = mac_selinux_access_check(message, "halt", reterr_error); if (r < 0) return r; @@ -1755,17 +1755,17 @@ static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *er return sd_bus_reply_method_return(message, NULL); } -static int method_kexec(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_kexec(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); if (!MANAGER_IS_SYSTEM(m)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "KExec is only supported by system manager."); - r = mac_selinux_access_check(message, "reboot", error); + r = mac_selinux_access_check(message, "reboot", reterr_error); if (r < 0) return r; @@ -1776,7 +1776,7 @@ static int method_kexec(sd_bus_message *message, void *userdata, sd_bus_error *e return sd_bus_reply_method_return(message, NULL); } -static int method_switch_root(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_switch_root(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); _cleanup_free_ char *ri = NULL, *rt = NULL; const char *root, *init; @@ -1785,10 +1785,10 @@ static int method_switch_root(sd_bus_message *message, void *userdata, sd_bus_er assert(message); if (!MANAGER_IS_SYSTEM(m)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Root switching is only supported by system manager."); - r = mac_selinux_access_check(message, "reboot", error); + r = mac_selinux_access_check(message, "reboot", reterr_error); if (r < 0) return r; @@ -1802,53 +1802,53 @@ static int method_switch_root(sd_bus_message *message, void *userdata, sd_bus_er root = "/sysroot"; else { if (!path_is_valid(root)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "New root directory must be a valid path."); if (!path_is_absolute(root)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "New root path '%s' is not absolute.", root); r = path_is_root(root); if (r < 0) - return sd_bus_error_set_errnof(error, r, + return sd_bus_error_set_errnof(reterr_error, r, "Failed to check if new root directory '%s' is the same as old root: %m", root); if (r > 0) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "New root directory cannot be the old root directory."); } /* Safety check */ if (!in_initrd()) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Not in initrd, refusing switch-root operation."); r = path_is_os_tree(root); if (r < 0) - return sd_bus_error_set_errnof(error, r, + return sd_bus_error_set_errnof(reterr_error, r, "Failed to determine whether root path '%s' contains an OS tree: %m", root); if (r == 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Specified switch root path '%s' does not seem to be an OS tree. os-release file is missing.", root); if (!isempty(init)) { if (!path_is_valid(init)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path to init binary '%s' is not a valid path.", init); if (!path_is_absolute(init)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path to init binary '%s' not absolute.", init); r = chase_and_access(init, root, CHASE_PREFIX_ROOT, X_OK, NULL); if (r == -EACCES) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Init binary %s is not executable.", init); if (r < 0) - return sd_bus_error_set_errnof(error, r, + return sd_bus_error_set_errnof(reterr_error, r, "Could not resolve init executable %s: %m", init); } @@ -1870,14 +1870,14 @@ static int method_switch_root(sd_bus_message *message, void *userdata, sd_bus_er return sd_bus_reply_method_return(message, NULL); } -static int method_set_environment(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_set_environment(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **plus = NULL; Manager *m = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_access_check(message, "reload", error); + r = mac_selinux_access_check(message, "reload", reterr_error); if (r < 0) return r; @@ -1885,9 +1885,9 @@ static int method_set_environment(sd_bus_message *message, void *userdata, sd_bu if (r < 0) return r; if (!strv_env_is_valid(plus)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment assignments"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment assignments"); - r = bus_verify_set_environment_async(m, message, error); + r = bus_verify_set_environment_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -1900,14 +1900,14 @@ static int method_set_environment(sd_bus_message *message, void *userdata, sd_bu return sd_bus_reply_method_return(message, NULL); } -static int method_unset_environment(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_unset_environment(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **minus = NULL; Manager *m = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_access_check(message, "reload", error); + r = mac_selinux_access_check(message, "reload", reterr_error); if (r < 0) return r; @@ -1916,10 +1916,10 @@ static int method_unset_environment(sd_bus_message *message, void *userdata, sd_ return r; if (!strv_env_name_or_assignment_is_valid(minus)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment variable names or assignments"); - r = bus_verify_set_environment_async(m, message, error); + r = bus_verify_set_environment_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -1932,14 +1932,14 @@ static int method_unset_environment(sd_bus_message *message, void *userdata, sd_ return sd_bus_reply_method_return(message, NULL); } -static int method_unset_and_set_environment(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_unset_and_set_environment(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **minus = NULL, **plus = NULL; Manager *m = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_access_check(message, "reload", error); + r = mac_selinux_access_check(message, "reload", reterr_error); if (r < 0) return r; @@ -1952,13 +1952,13 @@ static int method_unset_and_set_environment(sd_bus_message *message, void *userd return r; if (!strv_env_name_or_assignment_is_valid(minus)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment variable names or assignments"); if (!strv_env_is_valid(plus)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment assignments"); - r = bus_verify_set_environment_async(m, message, error); + r = bus_verify_set_environment_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -1971,14 +1971,14 @@ static int method_unset_and_set_environment(sd_bus_message *message, void *userd return sd_bus_reply_method_return(message, NULL); } -static int method_set_exit_code(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_set_exit_code(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); uint8_t code; int r; assert(message); - r = mac_selinux_access_check(message, "exit", error); + r = mac_selinux_access_check(message, "exit", reterr_error); if (r < 0) return r; @@ -1991,7 +1991,7 @@ static int method_set_exit_code(sd_bus_message *message, void *userdata, sd_bus_ return sd_bus_reply_method_return(message, NULL); } -static int method_lookup_dynamic_user_by_name(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_lookup_dynamic_user_by_name(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); const char *name; uid_t uid; @@ -2004,15 +2004,15 @@ static int method_lookup_dynamic_user_by_name(sd_bus_message *message, void *use return r; if (!MANAGER_IS_SYSTEM(m)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Dynamic users are only supported in the system instance."); if (!valid_user_group_name(name, VALID_USER_RELAX)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "User name invalid: %s", name); r = dynamic_user_lookup_name(m, name, &uid); if (r == -ESRCH) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_DYNAMIC_USER, + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_DYNAMIC_USER, "Dynamic user %s does not exist.", name); if (r < 0) return r; @@ -2020,7 +2020,7 @@ static int method_lookup_dynamic_user_by_name(sd_bus_message *message, void *use return sd_bus_reply_method_return(message, "u", (uint32_t) uid); } -static int method_lookup_dynamic_user_by_uid(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_lookup_dynamic_user_by_uid(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_free_ char *name = NULL; Manager *m = ASSERT_PTR(userdata); uid_t uid; @@ -2034,15 +2034,15 @@ static int method_lookup_dynamic_user_by_uid(sd_bus_message *message, void *user return r; if (!MANAGER_IS_SYSTEM(m)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Dynamic users are only supported in the system instance."); if (!uid_is_valid(uid)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "User ID invalid: " UID_FMT, uid); r = dynamic_user_lookup_uid(m, uid, &name); if (r == -ESRCH) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_DYNAMIC_USER, + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_DYNAMIC_USER, "Dynamic user ID " UID_FMT " does not exist.", uid); if (r < 0) return r; @@ -2050,7 +2050,7 @@ static int method_lookup_dynamic_user_by_uid(sd_bus_message *message, void *user return sd_bus_reply_method_return(message, "s", name); } -static int method_get_dynamic_users(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_dynamic_users(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; Manager *m = ASSERT_PTR(userdata); DynamicUser *d; @@ -2061,7 +2061,7 @@ static int method_get_dynamic_users(sd_bus_message *message, void *userdata, sd_ assert_cc(sizeof(uid_t) == sizeof(uint32_t)); if (!MANAGER_IS_SYSTEM(m)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Dynamic users are only supported in the system instance."); r = sd_bus_message_new_method_return(message, &reply); @@ -2079,7 +2079,7 @@ static int method_get_dynamic_users(sd_bus_message *message, void *userdata, sd_ if (r == -EAGAIN) /* not realized yet? */ continue; if (r < 0) - return sd_bus_error_set(error, SD_BUS_ERROR_FAILED, + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_FAILED, "Failed to look up a dynamic user."); r = sd_bus_message_append(reply, "(us)", uid, d->name); @@ -2094,17 +2094,17 @@ static int method_get_dynamic_users(sd_bus_message *message, void *userdata, sd_ return sd_bus_message_send(reply); } -static int method_enqueue_marked_jobs(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_enqueue_marked_jobs(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_access_check(message, "start", error); + r = mac_selinux_access_check(message, "start", reterr_error); if (r < 0) return r; - r = bus_verify_manage_units_async(m, message, error); + r = bus_verify_manage_units_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -2137,22 +2137,22 @@ static int method_enqueue_marked_jobs(sd_bus_message *message, void *userdata, s else continue; - r = mac_selinux_unit_access_check(u, message, "start", error); + r = mac_selinux_unit_access_check(u, message, "start", reterr_error); if (r >= 0) r = bus_unit_queue_job_one(message, u, JOB_TRY_RESTART, JOB_FAIL, flags, - reply, error); + reply, reterr_error); if (ERRNO_IS_NEG_RESOURCE(r)) return r; if (r < 0) { if (ret >= 0) ret = r; - sd_bus_error_free(error); + sd_bus_error_free(reterr_error); } } if (ret < 0) - return sd_bus_error_set_errnof(error, ret, + return sd_bus_error_set_errnof(reterr_error, ret, "Failed to enqueue some jobs, see logs for details: %m"); r = sd_bus_message_close_container(reply); @@ -2162,7 +2162,7 @@ static int method_enqueue_marked_jobs(sd_bus_message *message, void *userdata, s return sd_bus_message_send(reply); } -static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata, sd_bus_error *error, char **states, char **patterns) { +static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error, char **states, char **patterns) { Manager *m = ASSERT_PTR(userdata); _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; _cleanup_hashmap_free_ Hashmap *h = NULL; @@ -2172,7 +2172,7 @@ static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata, /* Anyone can call this method */ - r = mac_selinux_access_check(message, "status", error); + r = mac_selinux_access_check(message, "status", reterr_error); if (r < 0) return r; @@ -2202,11 +2202,11 @@ static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata, return sd_bus_message_send(reply); } -static int method_list_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return list_unit_files_by_patterns(message, userdata, error, NULL, NULL); +static int method_list_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return list_unit_files_by_patterns(message, userdata, reterr_error, NULL, NULL); } -static int method_list_unit_files_by_patterns(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_list_unit_files_by_patterns(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **states = NULL; _cleanup_strv_free_ char **patterns = NULL; int r; @@ -2219,10 +2219,10 @@ static int method_list_unit_files_by_patterns(sd_bus_message *message, void *use if (r < 0) return r; - return list_unit_files_by_patterns(message, userdata, error, states, patterns); + return list_unit_files_by_patterns(message, userdata, reterr_error, states, patterns); } -static int method_get_unit_file_state(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_unit_file_state(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); const char *name; UnitFileState state; @@ -2232,7 +2232,7 @@ static int method_get_unit_file_state(sd_bus_message *message, void *userdata, s /* Anyone can call this method */ - r = mac_selinux_access_check(message, "status", error); + r = mac_selinux_access_check(message, "status", reterr_error); if (r < 0) return r; @@ -2247,7 +2247,7 @@ static int method_get_unit_file_state(sd_bus_message *message, void *userdata, s return sd_bus_reply_method_return(message, "s", unit_file_state_to_string(state)); } -static int method_get_default_target(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_default_target(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_free_ char *default_target = NULL; Manager *m = ASSERT_PTR(userdata); int r; @@ -2256,13 +2256,13 @@ static int method_get_default_target(sd_bus_message *message, void *userdata, sd /* Anyone can call this method */ - r = mac_selinux_access_check(message, "status", error); + r = mac_selinux_access_check(message, "status", reterr_error); if (r < 0) return r; r = unit_file_get_default(m->runtime_scope, NULL, &default_target); if (r == -ERFKILL) - return sd_bus_error_set(error, BUS_ERROR_UNIT_MASKED, "Default target unit file is masked."); + return sd_bus_error_set(reterr_error, BUS_ERROR_UNIT_MASKED, "Default target unit file is masked."); if (r < 0) return r; @@ -2303,7 +2303,7 @@ static void manager_unit_files_changed(Manager *m, const InstallChange *changes, } static int install_error( - sd_bus_error *error, + sd_bus_error *reterr_error, int c, InstallChange *changes, size_t n_changes) { @@ -2328,9 +2328,9 @@ static int install_error( if (r == -ENOMEM) return r; if (r < 0) - return sd_bus_error_set_errnof(error, r, "File %s: %m", i->path); + return sd_bus_error_set_errnof(reterr_error, r, "File %s: %m", i->path); - return sd_bus_error_set(error, bus_error, err_message); + return sd_bus_error_set(reterr_error, bus_error, err_message); } return c < 0 ? c : -EINVAL; @@ -2342,7 +2342,7 @@ static int reply_install_changes_and_free( int carries_install_info, InstallChange *changes, size_t n_changes, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; bool bad = false, good = false; @@ -2384,7 +2384,7 @@ static int reply_install_changes_and_free( /* If there was a failed change, and no successful change, then return the first failure as proper * method call error. */ if (bad && !good) - return install_error(error, 0, TAKE_PTR(changes), n_changes); + return install_error(reterr_error, 0, TAKE_PTR(changes), n_changes); r = sd_bus_message_close_container(reply); if (r < 0) @@ -2398,7 +2398,7 @@ static int method_enable_unit_files_generic( Manager *m, int (*call)(RuntimeScope scope, UnitFileFlags flags, const char *root_dir, char * const *files, InstallChange **changes, size_t *n_changes), bool carries_install_info, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_strv_free_ char **l = NULL; InstallChange *changes = NULL; @@ -2431,7 +2431,7 @@ static int method_enable_unit_files_generic( flags = unit_file_bools_to_flags(runtime, force); } - r = bus_verify_manage_unit_files_async(m, message, error); + r = bus_verify_manage_unit_files_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -2440,40 +2440,40 @@ static int method_enable_unit_files_generic( r = call(m->runtime_scope, flags, NULL, l, &changes, &n_changes); manager_unit_files_changed(m, changes, n_changes); if (r < 0) - return install_error(error, r, changes, n_changes); + return install_error(reterr_error, r, changes, n_changes); - return reply_install_changes_and_free(m, message, carries_install_info ? r : -1, changes, n_changes, error); + return reply_install_changes_and_free(m, message, carries_install_info ? r : -1, changes, n_changes, reterr_error); } -static int method_enable_unit_files_with_flags(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_enable_unit_files_generic(message, userdata, unit_file_enable, /* carries_install_info = */ true, error); +static int method_enable_unit_files_with_flags(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_enable_unit_files_generic(message, userdata, unit_file_enable, /* carries_install_info = */ true, reterr_error); } -static int method_enable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_enable_unit_files_generic(message, userdata, unit_file_enable, /* carries_install_info = */ true, error); +static int method_enable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_enable_unit_files_generic(message, userdata, unit_file_enable, /* carries_install_info = */ true, reterr_error); } -static int method_reenable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_enable_unit_files_generic(message, userdata, unit_file_reenable, /* carries_install_info = */ true, error); +static int method_reenable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_enable_unit_files_generic(message, userdata, unit_file_reenable, /* carries_install_info = */ true, reterr_error); } -static int method_link_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_enable_unit_files_generic(message, userdata, unit_file_link, /* carries_install_info = */ false, error); +static int method_link_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_enable_unit_files_generic(message, userdata, unit_file_link, /* carries_install_info = */ false, reterr_error); } static int unit_file_preset_without_mode(RuntimeScope scope, UnitFileFlags flags, const char *root_dir, char * const *files, InstallChange **changes, size_t *n_changes) { return unit_file_preset(scope, flags, root_dir, files, UNIT_FILE_PRESET_FULL, changes, n_changes); } -static int method_preset_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_enable_unit_files_generic(message, userdata, unit_file_preset_without_mode, /* carries_install_info = */ true, error); +static int method_preset_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_enable_unit_files_generic(message, userdata, unit_file_preset_without_mode, /* carries_install_info = */ true, reterr_error); } -static int method_mask_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_enable_unit_files_generic(message, userdata, unit_file_mask, /* carries_install_info = */ false, error); +static int method_mask_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_enable_unit_files_generic(message, userdata, unit_file_mask, /* carries_install_info = */ false, reterr_error); } -static int method_preset_unit_files_with_mode(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_preset_unit_files_with_mode(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **l = NULL; InstallChange *changes = NULL; @@ -2504,7 +2504,7 @@ static int method_preset_unit_files_with_mode(sd_bus_message *message, void *use return -EINVAL; } - r = bus_verify_manage_unit_files_async(m, message, error); + r = bus_verify_manage_unit_files_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -2513,9 +2513,9 @@ static int method_preset_unit_files_with_mode(sd_bus_message *message, void *use r = unit_file_preset(m->runtime_scope, flags, NULL, l, preset_mode, &changes, &n_changes); manager_unit_files_changed(m, changes, n_changes); if (r < 0) - return install_error(error, r, changes, n_changes); + return install_error(reterr_error, r, changes, n_changes); - return reply_install_changes_and_free(m, message, r, changes, n_changes, error); + return reply_install_changes_and_free(m, message, r, changes, n_changes, reterr_error); } static int method_disable_unit_files_generic( @@ -2523,7 +2523,7 @@ static int method_disable_unit_files_generic( Manager *m, int (*call)(RuntimeScope scope, UnitFileFlags flags, const char *root_dir, char * const *files, InstallChange **changes, size_t *n_changes), bool carries_install_info, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_strv_free_ char **l = NULL; InstallChange *changes = NULL; @@ -2558,7 +2558,7 @@ static int method_disable_unit_files_generic( flags = unit_file_bools_to_flags(runtime, false); } - r = bus_verify_manage_unit_files_async(m, message, error); + r = bus_verify_manage_unit_files_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -2567,28 +2567,28 @@ static int method_disable_unit_files_generic( r = call(m->runtime_scope, flags, NULL, l, &changes, &n_changes); manager_unit_files_changed(m, changes, n_changes); if (r < 0) - return install_error(error, r, changes, n_changes); + return install_error(reterr_error, r, changes, n_changes); - return reply_install_changes_and_free(m, message, carries_install_info ? r : -1, changes, n_changes, error); + return reply_install_changes_and_free(m, message, carries_install_info ? r : -1, changes, n_changes, reterr_error); } -static int method_disable_unit_files_with_flags(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info = */ false, error); +static int method_disable_unit_files_with_flags(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info = */ false, reterr_error); } -static int method_disable_unit_files_with_flags_and_install_info(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info = */ true, error); +static int method_disable_unit_files_with_flags_and_install_info(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info = */ true, reterr_error); } -static int method_disable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info = */ false, error); +static int method_disable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info = */ false, reterr_error); } -static int method_unmask_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_disable_unit_files_generic(message, userdata, unit_file_unmask, /* carries_install_info = */ false, error); +static int method_unmask_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_disable_unit_files_generic(message, userdata, unit_file_unmask, /* carries_install_info = */ false, reterr_error); } -static int method_revert_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_revert_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **l = NULL; InstallChange *changes = NULL; size_t n_changes = 0; @@ -2601,7 +2601,7 @@ static int method_revert_unit_files(sd_bus_message *message, void *userdata, sd_ if (r < 0) return r; - r = bus_verify_manage_unit_files_async(m, message, error); + r = bus_verify_manage_unit_files_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -2610,12 +2610,12 @@ static int method_revert_unit_files(sd_bus_message *message, void *userdata, sd_ r = unit_file_revert(m->runtime_scope, NULL, l, &changes, &n_changes); manager_unit_files_changed(m, changes, n_changes); if (r < 0) - return install_error(error, r, changes, n_changes); + return install_error(reterr_error, r, changes, n_changes); - return reply_install_changes_and_free(m, message, -1, changes, n_changes, error); + return reply_install_changes_and_free(m, message, -1, changes, n_changes, reterr_error); } -static int method_set_default_target(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_set_default_target(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { InstallChange *changes = NULL; size_t n_changes = 0; Manager *m = ASSERT_PTR(userdata); @@ -2624,7 +2624,7 @@ static int method_set_default_target(sd_bus_message *message, void *userdata, sd assert(message); - r = mac_selinux_access_check(message, "enable", error); + r = mac_selinux_access_check(message, "enable", reterr_error); if (r < 0) return r; @@ -2632,7 +2632,7 @@ static int method_set_default_target(sd_bus_message *message, void *userdata, sd if (r < 0) return r; - r = bus_verify_manage_unit_files_async(m, message, error); + r = bus_verify_manage_unit_files_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -2641,12 +2641,12 @@ static int method_set_default_target(sd_bus_message *message, void *userdata, sd r = unit_file_set_default(m->runtime_scope, force ? UNIT_FILE_FORCE : 0, NULL, name, &changes, &n_changes); manager_unit_files_changed(m, changes, n_changes); if (r < 0) - return install_error(error, r, changes, n_changes); + return install_error(reterr_error, r, changes, n_changes); - return reply_install_changes_and_free(m, message, -1, changes, n_changes, error); + return reply_install_changes_and_free(m, message, -1, changes, n_changes, reterr_error); } -static int method_preset_all_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_preset_all_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { InstallChange *changes = NULL; size_t n_changes = 0; Manager *m = ASSERT_PTR(userdata); @@ -2657,7 +2657,7 @@ static int method_preset_all_unit_files(sd_bus_message *message, void *userdata, assert(message); - r = mac_selinux_access_check(message, "enable", error); + r = mac_selinux_access_check(message, "enable", reterr_error); if (r < 0) return r; @@ -2675,7 +2675,7 @@ static int method_preset_all_unit_files(sd_bus_message *message, void *userdata, return -EINVAL; } - r = bus_verify_manage_unit_files_async(m, message, error); + r = bus_verify_manage_unit_files_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -2684,12 +2684,12 @@ static int method_preset_all_unit_files(sd_bus_message *message, void *userdata, r = unit_file_preset_all(m->runtime_scope, flags, NULL, preset_mode, &changes, &n_changes); manager_unit_files_changed(m, changes, n_changes); if (r < 0) - return install_error(error, r, changes, n_changes); + return install_error(reterr_error, r, changes, n_changes); - return reply_install_changes_and_free(m, message, -1, changes, n_changes, error); + return reply_install_changes_and_free(m, message, -1, changes, n_changes, reterr_error); } -static int method_add_dependency_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_add_dependency_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **l = NULL; Manager *m = ASSERT_PTR(userdata); InstallChange *changes = NULL; @@ -2701,7 +2701,7 @@ static int method_add_dependency_unit_files(sd_bus_message *message, void *userd assert(message); - r = bus_verify_manage_unit_files_async(m, message, error); + r = bus_verify_manage_unit_files_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -2724,12 +2724,12 @@ static int method_add_dependency_unit_files(sd_bus_message *message, void *userd r = unit_file_add_dependency(m->runtime_scope, flags, NULL, l, target, dep, &changes, &n_changes); manager_unit_files_changed(m, changes, n_changes); if (r < 0) - return install_error(error, r, changes, n_changes); + return install_error(reterr_error, r, changes, n_changes); - return reply_install_changes_and_free(m, message, -1, changes, n_changes, error); + return reply_install_changes_and_free(m, message, -1, changes, n_changes, reterr_error); } -static int method_get_unit_file_links(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_unit_file_links(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; Manager *m = ASSERT_PTR(userdata); InstallChange *changes = NULL; @@ -2771,7 +2771,7 @@ static int method_get_unit_file_links(sd_bus_message *message, void *userdata, s return sd_bus_message_send(reply); } -static int method_get_job_waiting(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_get_job_waiting(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); uint32_t id; Job *j; @@ -2785,12 +2785,12 @@ static int method_get_job_waiting(sd_bus_message *message, void *userdata, sd_bu j = manager_get_job(m, id); if (!j) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id); - return bus_job_method_get_waiting_jobs(message, j, error); + return bus_job_method_get_waiting_jobs(message, j, reterr_error); } -static int method_abandon_scope(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_abandon_scope(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); const char *name; Unit *u; @@ -2802,18 +2802,18 @@ static int method_abandon_scope(sd_bus_message *message, void *userdata, sd_bus_ if (r < 0) return r; - r = bus_get_unit_by_name(m, message, name, &u, error); + r = bus_get_unit_by_name(m, message, name, &u, reterr_error); if (r < 0) return r; if (u->type != UNIT_SCOPE) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unit '%s' is not a scope unit, refusing.", name); - return bus_scope_method_abandon(message, u, error); + return bus_scope_method_abandon(message, u, reterr_error); } -static int method_set_show_status(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int method_set_show_status(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); ShowStatus mode = _SHOW_STATUS_INVALID; const char *t; @@ -2821,11 +2821,11 @@ static int method_set_show_status(sd_bus_message *message, void *userdata, sd_bu assert(message); - r = mac_selinux_access_check(message, "reload", error); + r = mac_selinux_access_check(message, "reload", reterr_error); if (r < 0) return r; - r = bus_verify_set_environment_async(m, message, error); + r = bus_verify_set_environment_async(m, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -2838,7 +2838,7 @@ static int method_set_show_status(sd_bus_message *message, void *userdata, sd_bu if (!isempty(t)) { mode = show_status_from_string(t); if (mode < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid show status '%s'", t); } @@ -2847,12 +2847,12 @@ static int method_set_show_status(sd_bus_message *message, void *userdata, sd_bu return sd_bus_reply_method_return(message, NULL); } -static int method_dump_unit_descriptor_store(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return method_generic_unit_operation(message, userdata, error, UNIT_SERVICE, bus_service_method_dump_file_descriptor_store, GENERIC_UNIT_VALIDATE_LOADED); +static int method_dump_unit_descriptor_store(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return method_generic_unit_operation(message, userdata, reterr_error, UNIT_SERVICE, bus_service_method_dump_file_descriptor_store, GENERIC_UNIT_VALIDATE_LOADED); } -static int method_start_aux_scope(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "StartAuxiliaryScope() method has been removed."); +static int method_start_aux_scope(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "StartAuxiliaryScope() method has been removed."); } const sd_bus_vtable bus_manager_vtable[] = { diff --git a/src/core/dbus-manager.h b/src/core/dbus-manager.h index 4dd6492255e..201a8760787 100644 --- a/src/core/dbus-manager.h +++ b/src/core/dbus-manager.h @@ -8,11 +8,32 @@ extern const sd_bus_vtable bus_manager_vtable[]; extern const sd_bus_vtable bus_manager_log_control_vtable[]; -void bus_manager_send_finished(Manager *m, usec_t firmware_usec, usec_t loader_usec, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec); +void bus_manager_send_finished( + Manager *m, + usec_t firmware_usec, + usec_t loader_usec, + usec_t kernel_usec, + usec_t initrd_usec, + usec_t userspace_usec, + usec_t total_usec); void bus_manager_send_reloading(Manager *m, bool active); void bus_manager_send_change_signal(Manager *m); int verify_run_space_and_log(const char *message); -int bus_property_get_oom_policy(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *ret_error); -int bus_property_get_emergency_action(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *ret_error); +int bus_property_get_oom_policy( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); +int bus_property_get_emergency_action( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c index 50fa339fb4f..abcaac1bd99 100644 --- a/src/core/dbus-mount.c +++ b/src/core/dbus-mount.c @@ -18,7 +18,7 @@ static int property_get_where( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Mount *m = ASSERT_PTR(userdata); @@ -39,7 +39,7 @@ static int property_get_what( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_free_ char *escaped = NULL; Mount *m = ASSERT_PTR(userdata); @@ -61,7 +61,7 @@ static int property_get_options( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_free_ char *escaped = NULL; Mount *m = ASSERT_PTR(userdata); @@ -109,7 +109,7 @@ static int bus_mount_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = UNIT(m); int r; @@ -121,7 +121,7 @@ static int bus_mount_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "Where")) - return bus_set_transient_path(u, name, &m->where, message, flags, error); + return bus_set_transient_path(u, name, &m->where, message, flags, reterr_error); if (streq(name, "What")) { _cleanup_free_ char *path = NULL; @@ -138,7 +138,7 @@ static int bus_mount_set_transient_property( /* path_is_valid is not used - see the comment for config_parse_mount_node */ if (strlen(path) >= PATH_MAX) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Resolved What=%s too long", path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Resolved What=%s too long", path); } if (!UNIT_WRITE_FLAGS_NOOP(flags)) { @@ -150,28 +150,28 @@ static int bus_mount_set_transient_property( } if (streq(name, "Options")) - return bus_set_transient_string(u, name, &m->parameters_fragment.options, message, flags, error); + return bus_set_transient_string(u, name, &m->parameters_fragment.options, message, flags, reterr_error); if (streq(name, "Type")) - return bus_set_transient_string(u, name, &m->parameters_fragment.fstype, message, flags, error); + return bus_set_transient_string(u, name, &m->parameters_fragment.fstype, message, flags, reterr_error); if (streq(name, "TimeoutUSec")) - return bus_set_transient_usec_fix_0(u, name, &m->timeout_usec, message, flags, error); + return bus_set_transient_usec_fix_0(u, name, &m->timeout_usec, message, flags, reterr_error); if (streq(name, "DirectoryMode")) - return bus_set_transient_mode_t(u, name, &m->directory_mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &m->directory_mode, message, flags, reterr_error); if (streq(name, "SloppyOptions")) - return bus_set_transient_bool(u, name, &m->sloppy_options, message, flags, error); + return bus_set_transient_bool(u, name, &m->sloppy_options, message, flags, reterr_error); if (streq(name, "LazyUnmount")) - return bus_set_transient_bool(u, name, &m->lazy_unmount, message, flags, error); + return bus_set_transient_bool(u, name, &m->lazy_unmount, message, flags, reterr_error); if (streq(name, "ForceUnmount")) - return bus_set_transient_bool(u, name, &m->force_unmount, message, flags, error); + return bus_set_transient_bool(u, name, &m->force_unmount, message, flags, reterr_error); if (streq(name, "ReadWriteOnly")) - return bus_set_transient_bool(u, name, &m->read_write_only, message, flags, error); + return bus_set_transient_bool(u, name, &m->read_write_only, message, flags, reterr_error); return 0; } @@ -181,7 +181,7 @@ int bus_mount_set_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Mount *m = MOUNT(u); int r; @@ -190,22 +190,22 @@ int bus_mount_set_property( assert(name); assert(message); - r = bus_cgroup_set_property(u, &m->cgroup_context, name, message, flags, error); + r = bus_cgroup_set_property(u, &m->cgroup_context, name, message, flags, reterr_error); if (r != 0) return r; if (u->transient && u->load_state == UNIT_STUB) { /* This is a transient unit, let's load a little more */ - r = bus_mount_set_transient_property(m, name, message, flags, error); + r = bus_mount_set_transient_property(m, name, message, flags, reterr_error); if (r != 0) return r; - r = bus_exec_context_set_transient_property(u, &m->exec_context, name, message, flags, error); + r = bus_exec_context_set_transient_property(u, &m->exec_context, name, message, flags, reterr_error); if (r != 0) return r; - r = bus_kill_context_set_transient_property(u, &m->kill_context, name, message, flags, error); + r = bus_kill_context_set_transient_property(u, &m->kill_context, name, message, flags, reterr_error); if (r != 0) return r; } diff --git a/src/core/dbus-mount.h b/src/core/dbus-mount.h index 2ea4c74f624..900158611f5 100644 --- a/src/core/dbus-mount.h +++ b/src/core/dbus-mount.h @@ -7,5 +7,10 @@ extern const sd_bus_vtable bus_mount_vtable[]; -int bus_mount_set_property(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); +int bus_mount_set_property( + Unit *u, + const char *name, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); int bus_mount_commit_properties(Unit *u); diff --git a/src/core/dbus-path.c b/src/core/dbus-path.c index 8cb6a265fab..22f6209ac91 100644 --- a/src/core/dbus-path.c +++ b/src/core/dbus-path.c @@ -19,7 +19,7 @@ static int property_get_paths( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Path *p = ASSERT_PTR(userdata); int r; @@ -57,7 +57,7 @@ static int bus_path_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = UNIT(p); int r; @@ -69,10 +69,10 @@ static int bus_path_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "MakeDirectory")) - return bus_set_transient_bool(u, name, &p->make_directory, message, flags, error); + return bus_set_transient_bool(u, name, &p->make_directory, message, flags, reterr_error); if (streq(name, "DirectoryMode")) - return bus_set_transient_mode_t(u, name, &p->directory_mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &p->directory_mode, message, flags, reterr_error); if (streq(name, "Paths")) { const char *type_name, *path; @@ -87,13 +87,13 @@ static int bus_path_set_transient_property( t = path_type_from_string(type_name); if (t < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown path type: %s", type_name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unknown path type: %s", type_name); if (isempty(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path in %s is empty", type_name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path in %s is empty", type_name); if (!path_is_absolute(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path in %s is not absolute: %s", type_name, path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path in %s is not absolute: %s", type_name, path); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *k = NULL; @@ -136,10 +136,10 @@ static int bus_path_set_transient_property( } if (streq(name, "TriggerLimitBurst")) - return bus_set_transient_unsigned(u, name, &p->trigger_limit.burst, message, flags, error); + return bus_set_transient_unsigned(u, name, &p->trigger_limit.burst, message, flags, reterr_error); if (streq(name, "TriggerLimitIntervalUSec")) - return bus_set_transient_usec(u, name, &p->trigger_limit.interval, message, flags, error); + return bus_set_transient_usec(u, name, &p->trigger_limit.interval, message, flags, reterr_error); return 0; } @@ -149,7 +149,7 @@ int bus_path_set_property( const char *name, sd_bus_message *message, UnitWriteFlags mode, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Path *p = PATH(u); @@ -158,7 +158,7 @@ int bus_path_set_property( assert(message); if (u->transient && u->load_state == UNIT_STUB) - return bus_path_set_transient_property(p, name, message, mode, error); + return bus_path_set_transient_property(p, name, message, mode, reterr_error); return 0; } diff --git a/src/core/dbus-path.h b/src/core/dbus-path.h index c30466dc72a..0dc7645b08d 100644 --- a/src/core/dbus-path.h +++ b/src/core/dbus-path.h @@ -7,4 +7,9 @@ extern const sd_bus_vtable bus_path_vtable[]; -int bus_path_set_property(Unit *u, const char *name, sd_bus_message *i, UnitWriteFlags flags, sd_bus_error *error); +int bus_path_set_property( + Unit *u, + const char *name, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c index 2d2f65a9665..e79da0e9801 100644 --- a/src/core/dbus-scope.c +++ b/src/core/dbus-scope.c @@ -16,17 +16,17 @@ #include "string-util.h" #include "unit.h" -int bus_scope_method_abandon(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_scope_method_abandon(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Scope *s = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_unit_access_check(UNIT(s), message, "stop", error); + r = mac_selinux_unit_access_check(UNIT(s), message, "stop", reterr_error); if (r < 0) return r; - r = bus_verify_manage_units_async(UNIT(s)->manager, message, error); + r = bus_verify_manage_units_async(UNIT(s)->manager, message, reterr_error); if (r < 0) return r; if (r == 0) @@ -34,7 +34,7 @@ int bus_scope_method_abandon(sd_bus_message *message, void *userdata, sd_bus_err r = scope_abandon(s); if (r == -ESTALE) - return sd_bus_error_setf(error, BUS_ERROR_SCOPE_NOT_RUNNING, "Scope %s is not running, cannot abandon.", UNIT(s)->id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_SCOPE_NOT_RUNNING, "Scope %s is not running, cannot abandon.", UNIT(s)->id); if (r < 0) return r; @@ -62,7 +62,7 @@ static int bus_scope_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = UNIT(s); int r; @@ -74,16 +74,16 @@ static int bus_scope_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "TimeoutStopUSec")) - return bus_set_transient_usec(u, name, &s->timeout_stop_usec, message, flags, error); + return bus_set_transient_usec(u, name, &s->timeout_stop_usec, message, flags, reterr_error); if (streq(name, "RuntimeMaxUSec")) - return bus_set_transient_usec(u, name, &s->runtime_max_usec, message, flags, error); + return bus_set_transient_usec(u, name, &s->runtime_max_usec, message, flags, reterr_error); if (streq(name, "RuntimeRandomizedExtraUSec")) - return bus_set_transient_usec(u, name, &s->runtime_rand_extra_usec, message, flags, error); + return bus_set_transient_usec(u, name, &s->runtime_rand_extra_usec, message, flags, reterr_error); if (streq(name, "OOMPolicy")) - return bus_set_transient_oom_policy(u, name, &s->oom_policy, message, flags, error); + return bus_set_transient_oom_policy(u, name, &s->oom_policy, message, flags, reterr_error); if (streq(name, "PIDs")) { _cleanup_(pidref_done) PidRef sender_pidref = PIDREF_NULL; @@ -120,7 +120,7 @@ static int bus_scope_set_transient_property( p = &pidref; } - r = unit_pid_attachable(u, p, error); + r = unit_pid_attachable(u, p, reterr_error); if (r < 0) return r; @@ -161,7 +161,7 @@ static int bus_scope_set_transient_property( if (r < 0) return r; - r = unit_pid_attachable(u, &pidref, error); + r = unit_pid_attachable(u, &pidref, reterr_error); if (r < 0) return r; @@ -187,14 +187,14 @@ static int bus_scope_set_transient_property( /* We can't support direct connections with this, as direct connections know no service or unique name * concept, but the Controller field stores exactly that. */ if (sd_bus_message_get_bus(message) != u->manager->api_bus) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "Sorry, Controller= logic only supported via the bus."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Sorry, Controller= logic only supported via the bus."); r = sd_bus_message_read(message, "s", &controller); if (r < 0) return r; if (!isempty(controller) && !sd_bus_service_name_is_valid(controller)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Controller '%s' is not a valid bus name.", controller); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Controller '%s' is not a valid bus name.", controller); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = free_and_strdup(&s->controller, empty_to_null(controller)); @@ -213,7 +213,7 @@ int bus_scope_set_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Scope *s = SCOPE(u); int r; @@ -222,26 +222,26 @@ int bus_scope_set_property( assert(name); assert(message); - r = bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, error); + r = bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, reterr_error); if (r != 0) return r; if (u->load_state == UNIT_STUB) { /* While we are created we still accept PIDs */ - r = bus_scope_set_transient_property(s, name, message, flags, error); + r = bus_scope_set_transient_property(s, name, message, flags, reterr_error); if (r != 0) return r; - r = bus_kill_context_set_transient_property(u, &s->kill_context, name, message, flags, error); + r = bus_kill_context_set_transient_property(u, &s->kill_context, name, message, flags, reterr_error); if (r != 0) return r; if (streq(name, "User")) - return bus_set_transient_user_relaxed(u, name, &s->user, message, flags, error); + return bus_set_transient_user_relaxed(u, name, &s->user, message, flags, reterr_error); if (streq(name, "Group")) - return bus_set_transient_user_relaxed(u, name, &s->group, message, flags, error); + return bus_set_transient_user_relaxed(u, name, &s->group, message, flags, reterr_error); } return 0; diff --git a/src/core/dbus-scope.h b/src/core/dbus-scope.h index 017390ac5b6..7b69d051bff 100644 --- a/src/core/dbus-scope.h +++ b/src/core/dbus-scope.h @@ -7,11 +7,16 @@ extern const sd_bus_vtable bus_scope_vtable[]; -int bus_scope_set_property(Unit *u, const char *name, sd_bus_message *i, UnitWriteFlags flags, sd_bus_error *error); +int bus_scope_set_property( + Unit *u, + const char *name, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); int bus_scope_commit_properties(Unit *u); int bus_scope_send_request_stop(Scope *s); -int bus_scope_method_abandon(sd_bus_message *message, void *userdata, sd_bus_error *error); +int bus_scope_method_abandon(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); int bus_scope_track_controller(Scope *s); diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c index 79a7e224cc5..b6632e56cbe 100644 --- a/src/core/dbus-service.c +++ b/src/core/dbus-service.c @@ -51,7 +51,7 @@ static int property_get_open_files( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { OpenFile **open_files = ASSERT_PTR(userdata); int r; @@ -79,7 +79,7 @@ static int property_get_extra_file_descriptors( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Service *s = ASSERT_PTR(userdata); int r; @@ -107,7 +107,7 @@ static int property_get_exit_status_set( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { const ExitStatusSet *status_set = ASSERT_PTR(userdata); unsigned n; @@ -159,7 +159,7 @@ static int property_get_exit_status_set( return sd_bus_message_close_container(reply); } -static int bus_service_method_mount(sd_bus_message *message, void *userdata, sd_bus_error *error, bool is_image) { +static int bus_service_method_mount(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error, bool is_image) { MountInNamespaceFlags flags = 0; Unit *u = ASSERT_PTR(userdata); int r; @@ -167,13 +167,13 @@ static int bus_service_method_mount(sd_bus_message *message, void *userdata, sd_ assert(message); if (!MANAGER_IS_SYSTEM(u->manager)) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "Adding bind mounts at runtime is only supported by system manager"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Adding bind mounts at runtime is only supported by system manager"); - r = unit_can_live_mount(u, error); + r = unit_can_live_mount(u, reterr_error); if (r < 0) - return log_unit_debug_errno(u, r, "Cannot schedule live mount operation: %s", bus_error_message(error, r)); + return log_unit_debug_errno(u, r, "Cannot schedule live mount operation: %s", bus_error_message(reterr_error, r)); - r = mac_selinux_unit_access_check(u, message, "start", error); + r = mac_selinux_unit_access_check(u, message, "start", reterr_error); if (r < 0) return r; @@ -186,15 +186,15 @@ static int bus_service_method_mount(sd_bus_message *message, void *userdata, sd_ return r; if (!path_is_absolute(src) || !path_is_normalized(src)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Source path must be absolute and normalized"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Source path must be absolute and normalized"); if (!is_image && isempty(dest)) dest = src; else if (!path_is_absolute(dest) || !path_is_normalized(dest)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Destination path must be absolute and normalized"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Destination path must be absolute and normalized"); if (is_image) { - r = bus_read_mount_options(message, error, &options, NULL, ""); + r = bus_read_mount_options(message, reterr_error, &options, NULL, ""); if (r < 0) return r; } @@ -204,7 +204,7 @@ static int bus_service_method_mount(sd_bus_message *message, void *userdata, sd_ is_image ? "mount-image" : "bind-mount", N_("Authentication is required to mount on '$(unit)'."), message, - error); + reterr_error); if (r < 0) return r; if (r == 0) @@ -217,34 +217,34 @@ static int bus_service_method_mount(sd_bus_message *message, void *userdata, sd_ if (make_file_or_directory) flags |= MOUNT_IN_NAMESPACE_MAKE_FILE_OR_DIRECTORY; - r = unit_live_mount(u, src, dest, message, flags, options, error); + r = unit_live_mount(u, src, dest, message, flags, options, reterr_error); if (r < 0) return r; return 1; } -int bus_service_method_bind_mount(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_service_method_mount(message, userdata, error, false); +int bus_service_method_bind_mount(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_service_method_mount(message, userdata, reterr_error, false); } -int bus_service_method_mount_image(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_service_method_mount(message, userdata, error, true); +int bus_service_method_mount_image(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_service_method_mount(message, userdata, reterr_error, true); } -int bus_service_method_dump_file_descriptor_store(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_service_method_dump_file_descriptor_store(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; Service *s = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_unit_access_check(UNIT(s), message, "status", error); + r = mac_selinux_unit_access_check(UNIT(s), message, "status", reterr_error); if (r < 0) return r; if (s->n_fd_store_max == 0 && s->n_fd_store == 0) - return sd_bus_error_setf(error, BUS_ERROR_FILE_DESCRIPTOR_STORE_DISABLED, "File descriptor store not enabled for %s.", UNIT(s)->id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_FILE_DESCRIPTOR_STORE_DISABLED, "File descriptor store not enabled for %s.", UNIT(s)->id); r = sd_bus_message_new_method_return(message, &reply); if (r < 0) @@ -306,7 +306,7 @@ static int property_get_size_as_uint32( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { size_t *value = ASSERT_PTR(userdata); uint32_t sz = *value >= UINT32_MAX ? UINT32_MAX : (uint32_t) *value; @@ -424,7 +424,7 @@ static int bus_set_transient_exit_status( ExitStatusSet *status_set, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { const int32_t *status, *signal; size_t n_status, n_signal, i; @@ -457,7 +457,7 @@ static int bus_set_transient_exit_status( for (i = 0; i < n_status; i++) { if (status[i] < 0 || status[i] > 255) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid status code in %s: %"PRIi32, name, status[i]); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid status code in %s: %"PRIi32, name, status[i]); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = bitmap_set(&status_set->status, status[i]); @@ -473,7 +473,7 @@ static int bus_set_transient_exit_status( str = signal_to_string((int) signal[i]); if (!str) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal in %s: %"PRIi32, name, signal[i]); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal in %s: %"PRIi32, name, signal[i]); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = bitmap_set(&status_set->signal, signal[i]); @@ -495,7 +495,7 @@ static int bus_set_transient_exec_context_fd( int verify_mode, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { int fd, r; @@ -513,7 +513,7 @@ static int bus_set_transient_exec_context_fd( else r = fd_vet_accmode(fd, verify_mode); if (r < 0) - return sd_bus_error_set_errnof(error, r, "%s passed is of incompatible type: %m", name); + return sd_bus_error_set_errnof(reterr_error, r, "%s passed is of incompatible type: %m", name); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { int copy; @@ -544,7 +544,7 @@ static int bus_service_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = UNIT(s); ServiceExecCommand ci; @@ -557,37 +557,37 @@ static int bus_service_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "PermissionsStartOnly")) - return bus_set_transient_bool(u, name, &s->permissions_start_only, message, flags, error); + return bus_set_transient_bool(u, name, &s->permissions_start_only, message, flags, reterr_error); if (streq(name, "RootDirectoryStartOnly")) - return bus_set_transient_bool(u, name, &s->root_directory_start_only, message, flags, error); + return bus_set_transient_bool(u, name, &s->root_directory_start_only, message, flags, reterr_error); if (streq(name, "RemainAfterExit")) - return bus_set_transient_bool(u, name, &s->remain_after_exit, message, flags, error); + return bus_set_transient_bool(u, name, &s->remain_after_exit, message, flags, reterr_error); if (streq(name, "GuessMainPID")) - return bus_set_transient_bool(u, name, &s->guess_main_pid, message, flags, error); + return bus_set_transient_bool(u, name, &s->guess_main_pid, message, flags, reterr_error); if (streq(name, "Type")) - return bus_set_transient_service_type(u, name, &s->type, message, flags, error); + return bus_set_transient_service_type(u, name, &s->type, message, flags, reterr_error); if (streq(name, "ExitType")) - return bus_set_transient_service_exit_type(u, name, &s->exit_type, message, flags, error); + return bus_set_transient_service_exit_type(u, name, &s->exit_type, message, flags, reterr_error); if (streq(name, "OOMPolicy")) - return bus_set_transient_oom_policy(u, name, &s->oom_policy, message, flags, error); + return bus_set_transient_oom_policy(u, name, &s->oom_policy, message, flags, reterr_error); if (streq(name, "RestartUSec")) - return bus_set_transient_usec(u, name, &s->restart_usec, message, flags, error); + return bus_set_transient_usec(u, name, &s->restart_usec, message, flags, reterr_error); if (streq(name, "RestartSteps")) - return bus_set_transient_unsigned(u, name, &s->restart_steps, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->restart_steps, message, flags, reterr_error); if (streq(name, "RestartMaxDelayUSec")) - return bus_set_transient_usec(u, name, &s->restart_max_delay_usec, message, flags, error); + return bus_set_transient_usec(u, name, &s->restart_max_delay_usec, message, flags, reterr_error); if (streq(name, "TimeoutStartUSec")) { - r = bus_set_transient_usec(u, name, &s->timeout_start_usec, message, flags, error); + r = bus_set_transient_usec(u, name, &s->timeout_start_usec, message, flags, reterr_error); if (r >= 0 && !UNIT_WRITE_FLAGS_NOOP(flags)) s->start_timeout_defined = true; @@ -595,38 +595,38 @@ static int bus_service_set_transient_property( } if (streq(name, "TimeoutStopUSec")) - return bus_set_transient_usec(u, name, &s->timeout_stop_usec, message, flags, error); + return bus_set_transient_usec(u, name, &s->timeout_stop_usec, message, flags, reterr_error); if (streq(name, "TimeoutAbortUSec")) { - r = bus_set_transient_usec(u, name, &s->timeout_abort_usec, message, flags, error); + r = bus_set_transient_usec(u, name, &s->timeout_abort_usec, message, flags, reterr_error); if (r >= 0 && !UNIT_WRITE_FLAGS_NOOP(flags)) s->timeout_abort_set = true; return r; } if (streq(name, "TimeoutStartFailureMode")) - return bus_set_transient_timeout_failure_mode(u, name, &s->timeout_start_failure_mode, message, flags, error); + return bus_set_transient_timeout_failure_mode(u, name, &s->timeout_start_failure_mode, message, flags, reterr_error); if (streq(name, "TimeoutStopFailureMode")) - return bus_set_transient_timeout_failure_mode(u, name, &s->timeout_stop_failure_mode, message, flags, error); + return bus_set_transient_timeout_failure_mode(u, name, &s->timeout_stop_failure_mode, message, flags, reterr_error); if (streq(name, "RuntimeMaxUSec")) - return bus_set_transient_usec(u, name, &s->runtime_max_usec, message, flags, error); + return bus_set_transient_usec(u, name, &s->runtime_max_usec, message, flags, reterr_error); if (streq(name, "RuntimeRandomizedExtraUSec")) - return bus_set_transient_usec(u, name, &s->runtime_rand_extra_usec, message, flags, error); + return bus_set_transient_usec(u, name, &s->runtime_rand_extra_usec, message, flags, reterr_error); if (streq(name, "WatchdogUSec")) - return bus_set_transient_usec(u, name, &s->watchdog_usec, message, flags, error); + return bus_set_transient_usec(u, name, &s->watchdog_usec, message, flags, reterr_error); if (streq(name, "FileDescriptorStoreMax")) - return bus_set_transient_unsigned(u, name, &s->n_fd_store_max, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->n_fd_store_max, message, flags, reterr_error); if (streq(name, "FileDescriptorStorePreserve")) - return bus_set_transient_exec_preserve_mode(u, name, &s->fd_store_preserve_mode, message, flags, error); + return bus_set_transient_exec_preserve_mode(u, name, &s->fd_store_preserve_mode, message, flags, reterr_error); if (streq(name, "NotifyAccess")) - return bus_set_transient_notify_access(u, name, &s->notify_access, message, flags, error); + return bus_set_transient_notify_access(u, name, &s->notify_access, message, flags, reterr_error); if (streq(name, "PIDFile")) { _cleanup_free_ char *n = NULL; @@ -644,7 +644,7 @@ static int bus_service_set_transient_property( path_simplify(n); if (!path_is_normalized(n)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "PIDFile= path '%s' is not valid", n); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "PIDFile= path '%s' is not valid", n); e = path_startswith(n, "/var/run/"); if (e) { @@ -671,43 +671,43 @@ static int bus_service_set_transient_property( } if (streq(name, "USBFunctionDescriptors")) - return bus_set_transient_path(u, name, &s->usb_function_descriptors, message, flags, error); + return bus_set_transient_path(u, name, &s->usb_function_descriptors, message, flags, reterr_error); if (streq(name, "USBFunctionStrings")) - return bus_set_transient_path(u, name, &s->usb_function_strings, message, flags, error); + return bus_set_transient_path(u, name, &s->usb_function_strings, message, flags, reterr_error); if (streq(name, "BusName")) - return bus_set_transient_bus_name(u, name, &s->bus_name, message, flags, error); + return bus_set_transient_bus_name(u, name, &s->bus_name, message, flags, reterr_error); if (streq(name, "Restart")) - return bus_set_transient_service_restart(u, name, &s->restart, message, flags, error); + return bus_set_transient_service_restart(u, name, &s->restart, message, flags, reterr_error); if (streq(name, "RestartMode")) - return bus_set_transient_service_restart_mode(u, name, &s->restart_mode, message, flags, error); + return bus_set_transient_service_restart_mode(u, name, &s->restart_mode, message, flags, reterr_error); if (streq(name, "RestartPreventExitStatus")) - return bus_set_transient_exit_status(u, name, &s->restart_prevent_status, message, flags, error); + return bus_set_transient_exit_status(u, name, &s->restart_prevent_status, message, flags, reterr_error); if (streq(name, "RestartForceExitStatus")) - return bus_set_transient_exit_status(u, name, &s->restart_force_status, message, flags, error); + return bus_set_transient_exit_status(u, name, &s->restart_force_status, message, flags, reterr_error); if (streq(name, "SuccessExitStatus")) - return bus_set_transient_exit_status(u, name, &s->success_status, message, flags, error); + return bus_set_transient_exit_status(u, name, &s->success_status, message, flags, reterr_error); ci = service_exec_command_from_string(name); if (ci < 0) ci = service_exec_ex_command_from_string(name); if (ci >= 0) - return bus_set_transient_exec_command(u, name, &s->exec_command[ci], message, flags, error); + return bus_set_transient_exec_command(u, name, &s->exec_command[ci], message, flags, reterr_error); if (streq(name, "StandardInputFileDescriptor")) - return bus_set_transient_exec_context_fd(u, name, &s->stdin_fd, &s->exec_context.stdio_as_fds, O_RDONLY, message, flags, error); + return bus_set_transient_exec_context_fd(u, name, &s->stdin_fd, &s->exec_context.stdio_as_fds, O_RDONLY, message, flags, reterr_error); if (streq(name, "StandardOutputFileDescriptor")) - return bus_set_transient_exec_context_fd(u, name, &s->stdout_fd, &s->exec_context.stdio_as_fds, O_WRONLY, message, flags, error); + return bus_set_transient_exec_context_fd(u, name, &s->stdout_fd, &s->exec_context.stdio_as_fds, O_WRONLY, message, flags, reterr_error); if (streq(name, "StandardErrorFileDescriptor")) - return bus_set_transient_exec_context_fd(u, name, &s->stderr_fd, &s->exec_context.stdio_as_fds, O_WRONLY, message, flags, error); + return bus_set_transient_exec_context_fd(u, name, &s->stderr_fd, &s->exec_context.stdio_as_fds, O_WRONLY, message, flags, reterr_error); if (streq(name, "OpenFile")) { const char *path, *fdname; @@ -744,7 +744,7 @@ static int bus_service_set_transient_property( r = open_file_to_string(of, &ofs); if (r < 0) return sd_bus_error_set_errnof( - error, r, "Failed to convert OpenFile= value to string: %m"); + reterr_error, r, "Failed to convert OpenFile= value to string: %m"); LIST_APPEND(open_files, s->open_files, TAKE_PTR(of)); unit_write_settingf(u, flags | UNIT_ESCAPE_SPECIFIERS, name, "OpenFile=%s", ofs); @@ -760,7 +760,7 @@ static int bus_service_set_transient_property( } if (streq(name, "ReloadSignal")) - return bus_set_transient_reload_signal(u, name, &s->reload_signal, message, flags, error); + return bus_set_transient_reload_signal(u, name, &s->reload_signal, message, flags, reterr_error); if (streq(name, "ExtraFileDescriptors")) { r = sd_bus_message_enter_container(message, 'a', "(hs)"); @@ -781,10 +781,10 @@ static int bus_service_set_transient_property( * Unlike OpenFile, StandardInput and friends, there isn't a good sane * default for an arbitrary FD. */ if (isempty(fdname) || !fdname_is_valid(fdname)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid extra fd name: %s", fdname); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid extra fd name: %s", fdname); if (s->n_extra_fds >= NOTIFY_FD_MAX) - return sd_bus_error_set(error, SD_BUS_ERROR_LIMITS_EXCEEDED, "Too many extra fds sent"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_LIMITS_EXCEEDED, "Too many extra fds sent"); if (UNIT_WRITE_FLAGS_NOOP(flags)) continue; @@ -814,7 +814,7 @@ static int bus_service_set_transient_property( } if (streq(name, "RootDirectoryFileDescriptor")) - return bus_set_transient_exec_context_fd(u, name, &s->root_directory_fd, &s->exec_context.root_directory_as_fd, O_DIRECTORY, message, flags, error); + return bus_set_transient_exec_context_fd(u, name, &s->root_directory_fd, &s->exec_context.root_directory_as_fd, O_DIRECTORY, message, flags, reterr_error); return 0; } @@ -824,7 +824,7 @@ int bus_service_set_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Service *s = SERVICE(u); int r; @@ -833,22 +833,22 @@ int bus_service_set_property( assert(name); assert(message); - r = bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, error); + r = bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, reterr_error); if (r != 0) return r; if (u->transient && u->load_state == UNIT_STUB) { /* This is a transient unit, let's allow a little more */ - r = bus_service_set_transient_property(s, name, message, flags, error); + r = bus_service_set_transient_property(s, name, message, flags, reterr_error); if (r != 0) return r; - r = bus_exec_context_set_transient_property(u, &s->exec_context, name, message, flags, error); + r = bus_exec_context_set_transient_property(u, &s->exec_context, name, message, flags, reterr_error); if (r != 0) return r; - r = bus_kill_context_set_transient_property(u, &s->kill_context, name, message, flags, error); + r = bus_kill_context_set_transient_property(u, &s->kill_context, name, message, flags, reterr_error); if (r != 0) return r; } diff --git a/src/core/dbus-service.h b/src/core/dbus-service.h index 3977a3af494..54a5491f78f 100644 --- a/src/core/dbus-service.h +++ b/src/core/dbus-service.h @@ -7,8 +7,13 @@ extern const sd_bus_vtable bus_service_vtable[]; -int bus_service_set_property(Unit *u, const char *name, sd_bus_message *i, UnitWriteFlags flags, sd_bus_error *error); -int bus_service_method_bind_mount(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_service_method_mount_image(sd_bus_message *message, void *userdata, sd_bus_error *error); +int bus_service_set_property( + Unit *u, + const char *name, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); +int bus_service_method_bind_mount(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_service_method_mount_image(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); int bus_service_commit_properties(Unit *u); -int bus_service_method_dump_file_descriptor_store(sd_bus_message *message, void *userdata, sd_bus_error *error); +int bus_service_method_dump_file_descriptor_store(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); diff --git a/src/core/dbus-slice.c b/src/core/dbus-slice.c index e504665cce7..075ae59d419 100644 --- a/src/core/dbus-slice.c +++ b/src/core/dbus-slice.c @@ -15,7 +15,7 @@ static int property_get_currently_active( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Slice *s = ASSERT_PTR(userdata); @@ -43,7 +43,7 @@ static int bus_slice_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = UNIT(s); @@ -54,10 +54,10 @@ static int bus_slice_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "ConcurrencyHardMax")) - return bus_set_transient_unsigned(u, name, &s->concurrency_hard_max, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->concurrency_hard_max, message, flags, reterr_error); if (streq(name, "ConcurrencySoftMax")) - return bus_set_transient_unsigned(u, name, &s->concurrency_soft_max, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->concurrency_soft_max, message, flags, reterr_error); return 0; } @@ -67,7 +67,7 @@ int bus_slice_set_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Slice *s = SLICE(u); int r; @@ -75,14 +75,14 @@ int bus_slice_set_property( assert(name); assert(u); - r = bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, error); + r = bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, reterr_error); if (r != 0) return r; if (u->transient && u->load_state == UNIT_STUB) { /* This is a transient unit, let's allow a little more */ - r = bus_slice_set_transient_property(s, name, message, flags, error); + r = bus_slice_set_transient_property(s, name, message, flags, reterr_error); if (r != 0) return r; } diff --git a/src/core/dbus-slice.h b/src/core/dbus-slice.h index 7a11379a2c2..7bb14929887 100644 --- a/src/core/dbus-slice.h +++ b/src/core/dbus-slice.h @@ -7,5 +7,5 @@ extern const sd_bus_vtable bus_slice_vtable[]; -int bus_slice_set_property(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); +int bus_slice_set_property(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); int bus_slice_commit_properties(Unit *u); diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index 02039dd6db6..ecb4df4dfda 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -30,7 +30,7 @@ static int property_get_listen( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Socket *s = SOCKET(userdata); int r; @@ -158,7 +158,7 @@ static int bus_socket_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { SocketExecCommand ci; Unit *u = UNIT(s); @@ -171,169 +171,169 @@ static int bus_socket_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "Accept")) - return bus_set_transient_bool(u, name, &s->accept, message, flags, error); + return bus_set_transient_bool(u, name, &s->accept, message, flags, reterr_error); if (streq(name, "FlushPending")) - return bus_set_transient_bool(u, name, &s->flush_pending, message, flags, error); + return bus_set_transient_bool(u, name, &s->flush_pending, message, flags, reterr_error); if (streq(name, "Writable")) - return bus_set_transient_bool(u, name, &s->writable, message, flags, error); + return bus_set_transient_bool(u, name, &s->writable, message, flags, reterr_error); if (streq(name, "KeepAlive")) - return bus_set_transient_bool(u, name, &s->keep_alive, message, flags, error); + return bus_set_transient_bool(u, name, &s->keep_alive, message, flags, reterr_error); if (streq(name, "NoDelay")) - return bus_set_transient_bool(u, name, &s->no_delay, message, flags, error); + return bus_set_transient_bool(u, name, &s->no_delay, message, flags, reterr_error); if (streq(name, "FreeBind")) - return bus_set_transient_bool(u, name, &s->free_bind, message, flags, error); + return bus_set_transient_bool(u, name, &s->free_bind, message, flags, reterr_error); if (streq(name, "Transparent")) - return bus_set_transient_bool(u, name, &s->transparent, message, flags, error); + return bus_set_transient_bool(u, name, &s->transparent, message, flags, reterr_error); if (streq(name, "Broadcast")) - return bus_set_transient_bool(u, name, &s->broadcast, message, flags, error); + return bus_set_transient_bool(u, name, &s->broadcast, message, flags, reterr_error); if (streq(name, "PassCredentials")) - return bus_set_transient_bool(u, name, &s->pass_cred, message, flags, error); + return bus_set_transient_bool(u, name, &s->pass_cred, message, flags, reterr_error); if (streq(name, "PassPIDFD")) - return bus_set_transient_bool(u, name, &s->pass_pidfd, message, flags, error); + return bus_set_transient_bool(u, name, &s->pass_pidfd, message, flags, reterr_error); if (streq(name, "PassSecurity")) - return bus_set_transient_bool(u, name, &s->pass_sec, message, flags, error); + return bus_set_transient_bool(u, name, &s->pass_sec, message, flags, reterr_error); if (streq(name, "PassPacketInfo")) - return bus_set_transient_bool(u, name, &s->pass_pktinfo, message, flags, error); + return bus_set_transient_bool(u, name, &s->pass_pktinfo, message, flags, reterr_error); if (streq(name, "AcceptFileDescriptors")) - return bus_set_transient_bool(u, name, &s->pass_rights, message, flags, error); + return bus_set_transient_bool(u, name, &s->pass_rights, message, flags, reterr_error); if (streq(name, "Timestamping")) - return bus_set_transient_socket_timestamping(u, name, &s->timestamping, message, flags, error); + return bus_set_transient_socket_timestamping(u, name, &s->timestamping, message, flags, reterr_error); if (streq(name, "ReusePort")) - return bus_set_transient_bool(u, name, &s->reuse_port, message, flags, error); + return bus_set_transient_bool(u, name, &s->reuse_port, message, flags, reterr_error); if (streq(name, "RemoveOnStop")) - return bus_set_transient_bool(u, name, &s->remove_on_stop, message, flags, error); + return bus_set_transient_bool(u, name, &s->remove_on_stop, message, flags, reterr_error); if (streq(name, "SELinuxContextFromNet")) - return bus_set_transient_bool(u, name, &s->selinux_context_from_net, message, flags, error); + return bus_set_transient_bool(u, name, &s->selinux_context_from_net, message, flags, reterr_error); if (streq(name, "Priority")) - return bus_set_transient_int(u, name, &s->priority, message, flags, error); + return bus_set_transient_int(u, name, &s->priority, message, flags, reterr_error); if (streq(name, "IPTTL")) - return bus_set_transient_int(u, name, &s->ip_ttl, message, flags, error); + return bus_set_transient_int(u, name, &s->ip_ttl, message, flags, reterr_error); if (streq(name, "Mark")) - return bus_set_transient_int(u, name, &s->mark, message, flags, error); + return bus_set_transient_int(u, name, &s->mark, message, flags, reterr_error); if (streq(name, "Backlog")) - return bus_set_transient_unsigned(u, name, &s->backlog, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->backlog, message, flags, reterr_error); if (streq(name, "MaxConnections")) - return bus_set_transient_unsigned(u, name, &s->max_connections, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->max_connections, message, flags, reterr_error); if (streq(name, "MaxConnectionsPerSource")) - return bus_set_transient_unsigned(u, name, &s->max_connections_per_source, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->max_connections_per_source, message, flags, reterr_error); if (streq(name, "KeepAliveProbes")) - return bus_set_transient_unsigned(u, name, &s->keep_alive_cnt, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->keep_alive_cnt, message, flags, reterr_error); if (streq(name, "TriggerLimitBurst")) - return bus_set_transient_unsigned(u, name, &s->trigger_limit.burst, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->trigger_limit.burst, message, flags, reterr_error); if (streq(name, "PollLimitBurst")) - return bus_set_transient_unsigned(u, name, &s->poll_limit.burst, message, flags, error); + return bus_set_transient_unsigned(u, name, &s->poll_limit.burst, message, flags, reterr_error); if (streq(name, "SocketMode")) - return bus_set_transient_mode_t(u, name, &s->socket_mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &s->socket_mode, message, flags, reterr_error); if (streq(name, "DirectoryMode")) - return bus_set_transient_mode_t(u, name, &s->directory_mode, message, flags, error); + return bus_set_transient_mode_t(u, name, &s->directory_mode, message, flags, reterr_error); if (streq(name, "MessageQueueMaxMessages")) - return bus_set_transient_message_queue(u, name, &s->mq_maxmsg, message, flags, error); + return bus_set_transient_message_queue(u, name, &s->mq_maxmsg, message, flags, reterr_error); if (streq(name, "MessageQueueMessageSize")) - return bus_set_transient_message_queue(u, name, &s->mq_msgsize, message, flags, error); + return bus_set_transient_message_queue(u, name, &s->mq_msgsize, message, flags, reterr_error); if (streq(name, "TimeoutUSec")) - return bus_set_transient_usec_fix_0(u, name, &s->timeout_usec, message, flags, error); + return bus_set_transient_usec_fix_0(u, name, &s->timeout_usec, message, flags, reterr_error); if (streq(name, "KeepAliveTimeUSec")) - return bus_set_transient_usec(u, name, &s->keep_alive_time, message, flags, error); + return bus_set_transient_usec(u, name, &s->keep_alive_time, message, flags, reterr_error); if (streq(name, "KeepAliveIntervalUSec")) - return bus_set_transient_usec(u, name, &s->keep_alive_interval, message, flags, error); + return bus_set_transient_usec(u, name, &s->keep_alive_interval, message, flags, reterr_error); if (streq(name, "DeferAcceptUSec")) - return bus_set_transient_usec(u, name, &s->defer_accept, message, flags, error); + return bus_set_transient_usec(u, name, &s->defer_accept, message, flags, reterr_error); if (streq(name, "TriggerLimitIntervalUSec")) - return bus_set_transient_usec(u, name, &s->trigger_limit.interval, message, flags, error); + return bus_set_transient_usec(u, name, &s->trigger_limit.interval, message, flags, reterr_error); if (streq(name, "PollLimitIntervalUSec")) - return bus_set_transient_usec(u, name, &s->poll_limit.interval, message, flags, error); + return bus_set_transient_usec(u, name, &s->poll_limit.interval, message, flags, reterr_error); if (streq(name, "DeferTrigger")) - return bus_set_transient_socket_defer_trigger(u, name, &s->defer_trigger, message, flags, error); + return bus_set_transient_socket_defer_trigger(u, name, &s->defer_trigger, message, flags, reterr_error); if (streq(name, "DeferTriggerMaxUSec")) - return bus_set_transient_usec_fix_0(u, name, &s->defer_trigger_max_usec, message, flags, error); + return bus_set_transient_usec_fix_0(u, name, &s->defer_trigger_max_usec, message, flags, reterr_error); if (streq(name, "SmackLabel")) - return bus_set_transient_string(u, name, &s->smack, message, flags, error); + return bus_set_transient_string(u, name, &s->smack, message, flags, reterr_error); if (streq(name, "SmackLabelIPin")) - return bus_set_transient_string(u, name, &s->smack_ip_in, message, flags, error); + return bus_set_transient_string(u, name, &s->smack_ip_in, message, flags, reterr_error); if (streq(name, "SmackLabelIPOut")) - return bus_set_transient_string(u, name, &s->smack_ip_out, message, flags, error); + return bus_set_transient_string(u, name, &s->smack_ip_out, message, flags, reterr_error); if (streq(name, "TCPCongestion")) - return bus_set_transient_string(u, name, &s->tcp_congestion, message, flags, error); + return bus_set_transient_string(u, name, &s->tcp_congestion, message, flags, reterr_error); if (streq(name, "FileDescriptorName")) - return bus_set_transient_fdname(u, name, &s->fdname, message, flags, error); + return bus_set_transient_fdname(u, name, &s->fdname, message, flags, reterr_error); if (streq(name, "SocketUser")) - return bus_set_transient_user_relaxed(u, name, &s->user, message, flags, error); + return bus_set_transient_user_relaxed(u, name, &s->user, message, flags, reterr_error); if (streq(name, "SocketGroup")) - return bus_set_transient_user_relaxed(u, name, &s->group, message, flags, error); + return bus_set_transient_user_relaxed(u, name, &s->group, message, flags, reterr_error); if (streq(name, "BindIPv6Only")) - return bus_set_transient_bind_ipv6_only(u, name, &s->bind_ipv6_only, message, flags, error); + return bus_set_transient_bind_ipv6_only(u, name, &s->bind_ipv6_only, message, flags, reterr_error); if (streq(name, "ReceiveBuffer")) - return bus_set_transient_size_t_check_truncation(u, name, &s->receive_buffer, message, flags, error); + return bus_set_transient_size_t_check_truncation(u, name, &s->receive_buffer, message, flags, reterr_error); if (streq(name, "SendBuffer")) - return bus_set_transient_size_t_check_truncation(u, name, &s->send_buffer, message, flags, error); + return bus_set_transient_size_t_check_truncation(u, name, &s->send_buffer, message, flags, reterr_error); if (streq(name, "PipeSize")) - return bus_set_transient_size_t_check_truncation(u, name, &s->pipe_size, message, flags, error); + return bus_set_transient_size_t_check_truncation(u, name, &s->pipe_size, message, flags, reterr_error); if (streq(name, "BindToDevice")) - return bus_set_transient_ifname(u, name, &s->bind_to_device, message, flags, error); + return bus_set_transient_ifname(u, name, &s->bind_to_device, message, flags, reterr_error); if (streq(name, "IPTOS")) - return bus_set_transient_ip_tos(u, name, &s->ip_tos, message, flags, error); + return bus_set_transient_ip_tos(u, name, &s->ip_tos, message, flags, reterr_error); if (streq(name, "SocketProtocol")) - return bus_set_transient_socket_protocol(u, name, &s->socket_protocol, message, flags, error); + return bus_set_transient_socket_protocol(u, name, &s->socket_protocol, message, flags, reterr_error); if (streq(name, "PassFileDescriptorsToExec")) - return bus_set_transient_bool(u, name, &s->pass_fds_to_exec, message, flags, error); + return bus_set_transient_bool(u, name, &s->pass_fds_to_exec, message, flags, reterr_error); ci = socket_exec_command_from_string(name); if (ci >= 0) return bus_set_transient_exec_command(u, name, &s->exec_command[ci], - message, flags, error); + message, flags, reterr_error); if (streq(name, "Symlinks")) { _cleanup_strv_free_ char **l = NULL; @@ -344,7 +344,7 @@ static int bus_socket_set_transient_property( STRV_FOREACH(p, l) if (!path_is_absolute(*p)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Symlink path is not absolute: %s", *p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Symlink path is not absolute: %s", *p); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { if (strv_isempty(l)) { @@ -390,11 +390,11 @@ static int bus_socket_set_transient_property( p->type = socket_port_type_from_string(t); if (p->type < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown Socket type: %s", t); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unknown Socket type: %s", t); if (p->type != SOCKET_SOCKET) { if (!path_is_absolute(a) || !path_is_valid(a)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid socket path: %s", a); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid socket path: %s", a); r = path_simplify_alloc(a, &p->path); if (r < 0) @@ -403,19 +403,19 @@ static int bus_socket_set_transient_property( } else if (streq(t, "Netlink")) { r = socket_address_parse_netlink(&p->address, a); if (r < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid netlink address: %s", a); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid netlink address: %s", a); } else { r = socket_address_parse(&p->address, a); if (r < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid address: %s", a); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid address: %s", a); p->address.type = socket_address_type_from_string(t); if (p->address.type < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid address type: %s", t); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid address type: %s", t); if (socket_address_family(&p->address) != AF_UNIX && p->address.type == SOCK_SEQPACKET) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Address family not supported: %s", a); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Address family not supported: %s", a); } empty = false; @@ -448,7 +448,7 @@ int bus_socket_set_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Socket *s = SOCKET(u); int r; @@ -461,22 +461,22 @@ int bus_socket_set_property( assert(name); assert(message); - r = bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, error); + r = bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, reterr_error); if (r != 0) return r; if (u->transient && u->load_state == UNIT_STUB) { /* This is a transient unit, let's load a little more */ - r = bus_socket_set_transient_property(s, name, message, flags, error); + r = bus_socket_set_transient_property(s, name, message, flags, reterr_error); if (r != 0) return r; - r = bus_exec_context_set_transient_property(u, &s->exec_context, name, message, flags, error); + r = bus_exec_context_set_transient_property(u, &s->exec_context, name, message, flags, reterr_error); if (r != 0) return r; - r = bus_kill_context_set_transient_property(u, &s->kill_context, name, message, flags, error); + r = bus_kill_context_set_transient_property(u, &s->kill_context, name, message, flags, reterr_error); if (r != 0) return r; } diff --git a/src/core/dbus-socket.h b/src/core/dbus-socket.h index e638c39cf7d..4148d25930f 100644 --- a/src/core/dbus-socket.h +++ b/src/core/dbus-socket.h @@ -7,5 +7,5 @@ extern const sd_bus_vtable bus_socket_vtable[]; -int bus_socket_set_property(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); +int bus_socket_set_property(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); int bus_socket_commit_properties(Unit *u); diff --git a/src/core/dbus-swap.c b/src/core/dbus-swap.c index e733675f0f0..2f11965c81a 100644 --- a/src/core/dbus-swap.c +++ b/src/core/dbus-swap.c @@ -34,7 +34,7 @@ int bus_swap_set_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Swap *s = SWAP(u); @@ -42,7 +42,7 @@ int bus_swap_set_property( assert(name); assert(message); - return bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, error); + return bus_cgroup_set_property(u, &s->cgroup_context, name, message, flags, reterr_error); } int bus_swap_commit_properties(Unit *u) { diff --git a/src/core/dbus-swap.h b/src/core/dbus-swap.h index 485bf33e650..1fe2f6b6ec8 100644 --- a/src/core/dbus-swap.h +++ b/src/core/dbus-swap.h @@ -11,5 +11,5 @@ extern const sd_bus_vtable bus_swap_vtable[]; -int bus_swap_set_property(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); +int bus_swap_set_property(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); int bus_swap_commit_properties(Unit *u); diff --git a/src/core/dbus-timer.c b/src/core/dbus-timer.c index 638963a76b2..98fd8e5c5e4 100644 --- a/src/core/dbus-timer.c +++ b/src/core/dbus-timer.c @@ -19,7 +19,7 @@ static int property_get_monotonic_timers( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Timer *t = ASSERT_PTR(userdata); int r; @@ -56,7 +56,7 @@ static int property_get_calendar_timers( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Timer *t = ASSERT_PTR(userdata); int r; @@ -93,7 +93,7 @@ static int property_get_next_elapse_monotonic( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Timer *t = ASSERT_PTR(userdata); @@ -131,7 +131,7 @@ static int timer_add_one_monotonic_spec( TimerBase base, UnitWriteFlags flags, usec_t usec, - sd_bus_error *error) { + sd_bus_error *reterr_error) { if (!UNIT_WRITE_FLAGS_NOOP(flags)) { TimerValue *v; @@ -162,14 +162,14 @@ static int timer_add_one_calendar_spec( TimerBase base, UnitWriteFlags flags, const char *str, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_(calendar_spec_freep) CalendarSpec *c = NULL; int r; r = calendar_spec_from_string(str, &c); if (r == -EINVAL) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid calendar spec"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid calendar spec"); if (r < 0) return r; @@ -197,7 +197,7 @@ static int bus_timer_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = UNIT(t); int r; @@ -209,39 +209,39 @@ static int bus_timer_set_transient_property( flags |= UNIT_PRIVATE; if (streq(name, "AccuracyUSec")) - return bus_set_transient_usec(u, name, &t->accuracy_usec, message, flags, error); + return bus_set_transient_usec(u, name, &t->accuracy_usec, message, flags, reterr_error); if (streq(name, "AccuracySec")) { log_notice("Client is using obsolete AccuracySec= transient property, please use AccuracyUSec= instead."); - return bus_set_transient_usec(u, "AccuracyUSec", &t->accuracy_usec, message, flags, error); + return bus_set_transient_usec(u, "AccuracyUSec", &t->accuracy_usec, message, flags, reterr_error); } if (streq(name, "RandomizedDelayUSec")) - return bus_set_transient_usec(u, name, &t->random_delay_usec, message, flags, error); + return bus_set_transient_usec(u, name, &t->random_delay_usec, message, flags, reterr_error); if (streq(name, "RandomizedOffsetUSec")) - return bus_set_transient_usec(u, name, &t->random_offset_usec, message, flags, error); + return bus_set_transient_usec(u, name, &t->random_offset_usec, message, flags, reterr_error); if (streq(name, "FixedRandomDelay")) - return bus_set_transient_bool(u, name, &t->fixed_random_delay, message, flags, error); + return bus_set_transient_bool(u, name, &t->fixed_random_delay, message, flags, reterr_error); if (streq(name, "WakeSystem")) - return bus_set_transient_bool(u, name, &t->wake_system, message, flags, error); + return bus_set_transient_bool(u, name, &t->wake_system, message, flags, reterr_error); if (streq(name, "Persistent")) - return bus_set_transient_bool(u, name, &t->persistent, message, flags, error); + return bus_set_transient_bool(u, name, &t->persistent, message, flags, reterr_error); if (streq(name, "RemainAfterElapse")) - return bus_set_transient_bool(u, name, &t->remain_after_elapse, message, flags, error); + return bus_set_transient_bool(u, name, &t->remain_after_elapse, message, flags, reterr_error); if (streq(name, "OnTimezoneChange")) - return bus_set_transient_bool(u, name, &t->on_timezone_change, message, flags, error); + return bus_set_transient_bool(u, name, &t->on_timezone_change, message, flags, reterr_error); if (streq(name, "OnClockChange")) - return bus_set_transient_bool(u, name, &t->on_clock_change, message, flags, error); + return bus_set_transient_bool(u, name, &t->on_clock_change, message, flags, reterr_error); if (streq(name, "DeferReactivation")) - return bus_set_transient_bool(u, name, &t->defer_reactivation, message, flags, error); + return bus_set_transient_bool(u, name, &t->defer_reactivation, message, flags, reterr_error); if (streq(name, "TimersMonotonic")) { const char *base_name; @@ -257,10 +257,10 @@ static int bus_timer_set_transient_property( b = timer_base_from_string(base_name); if (b < 0 || b == TIMER_CALENDAR) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid timer base: %s", base_name); - r = timer_add_one_monotonic_spec(t, name, b, flags, usec, error); + r = timer_add_one_monotonic_spec(t, name, b, flags, usec, reterr_error); if (r < 0) return r; @@ -293,10 +293,10 @@ static int bus_timer_set_transient_property( b = timer_base_from_string(base_name); if (b != TIMER_CALENDAR) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid timer base: %s", base_name); - r = timer_add_one_calendar_spec(t, name, b, flags, str, error); + r = timer_add_one_calendar_spec(t, name, b, flags, str, reterr_error); if (r < 0) return r; @@ -330,13 +330,13 @@ static int bus_timer_set_transient_property( b = timer_base_from_string(name); if (b < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown timer base %s", name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unknown timer base %s", name); r = sd_bus_message_read(message, "t", &usec); if (r < 0) return r; - return timer_add_one_monotonic_spec(t, name, b, flags, usec, error); + return timer_add_one_monotonic_spec(t, name, b, flags, usec, reterr_error); } else if (streq(name, "OnCalendar")) { @@ -348,7 +348,7 @@ static int bus_timer_set_transient_property( if (r < 0) return r; - return timer_add_one_calendar_spec(t, name, TIMER_CALENDAR, flags, str, error); + return timer_add_one_calendar_spec(t, name, TIMER_CALENDAR, flags, str, reterr_error); } return 0; @@ -359,7 +359,7 @@ int bus_timer_set_property( const char *name, sd_bus_message *message, UnitWriteFlags mode, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Timer *t = TIMER(u); @@ -368,7 +368,7 @@ int bus_timer_set_property( assert(message); if (u->transient && u->load_state == UNIT_STUB) - return bus_timer_set_transient_property(t, name, message, mode, error); + return bus_timer_set_transient_property(t, name, message, mode, reterr_error); return 0; } diff --git a/src/core/dbus-timer.h b/src/core/dbus-timer.h index 52f2153cbc3..4a1f96b162f 100644 --- a/src/core/dbus-timer.h +++ b/src/core/dbus-timer.h @@ -7,4 +7,9 @@ extern const sd_bus_vtable bus_timer_vtable[]; -int bus_timer_set_property(Unit *u, const char *name, sd_bus_message *i, UnitWriteFlags flags, sd_bus_error *error); +int bus_timer_set_property( + Unit *u, + const char *name, + sd_bus_message *message, + UnitWriteFlags flags, + sd_bus_error *reterr_error); diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 34ead16ee1d..148384edcfb 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -59,7 +59,7 @@ static int property_get_can_clean( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = userdata; ExecCleanMask mask; @@ -101,14 +101,14 @@ static int property_get_can_live_mount( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); assert(bus); assert(reply); - return sd_bus_message_append(reply, "b", unit_can_live_mount(u, /* error= */ NULL) >= 0); + return sd_bus_message_append(reply, "b", unit_can_live_mount(u, /* reterr_error= */ NULL) >= 0); } static int property_get_names( @@ -118,7 +118,7 @@ static int property_get_names( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); const char *t; @@ -151,7 +151,7 @@ static int property_get_following( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = userdata, *f; @@ -170,7 +170,7 @@ static int property_get_dependencies( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = userdata, *other; UnitDependency d; @@ -207,7 +207,7 @@ static int property_get_mounts_for( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Hashmap **h = ASSERT_PTR(userdata); const char *p; @@ -237,7 +237,7 @@ static int property_get_unit_file_preset( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); int r; @@ -257,7 +257,7 @@ static int property_get_job( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_free_ char *p = NULL; Job **j = ASSERT_PTR(userdata); @@ -282,7 +282,7 @@ static int property_get_conditions( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { const char *(*to_string)(ConditionType type) = NULL; Condition **list = ASSERT_PTR(userdata); @@ -323,7 +323,7 @@ static int property_get_load_error( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_(sd_bus_error_free) sd_bus_error e = SD_BUS_ERROR_NULL; Unit *u = ASSERT_PTR(userdata); @@ -346,7 +346,7 @@ static int property_get_markers( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { unsigned *markers = ASSERT_PTR(userdata); int r; @@ -380,7 +380,7 @@ int bus_unit_method_start_generic( Unit *u, JobType job_type, bool reload_if_possible, - sd_bus_error *error) { + sd_bus_error *reterr_error) { BusUnitQueueFlags job_flags = reload_if_possible ? BUS_UNIT_QUEUE_RELOAD_IF_POSSIBLE : 0; const char *smode, *verb; @@ -394,7 +394,7 @@ int bus_unit_method_start_generic( r = mac_selinux_unit_access_check( u, message, job_type_to_access_method(job_type), - error); + reterr_error); if (r < 0) return r; @@ -404,7 +404,7 @@ int bus_unit_method_start_generic( mode = job_mode_from_string(smode); if (mode < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s invalid", smode); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s invalid", smode); if (reload_if_possible) verb = strjoina("reload-or-", job_type_to_string(job_type)); @@ -429,44 +429,44 @@ int bus_unit_method_start_generic( verb, polkit_message_for_job[job_type], message, - error); + reterr_error); if (r < 0) return r; if (r == 0) return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ - return bus_unit_queue_job(message, u, job_type, mode, job_flags, error); + return bus_unit_queue_job(message, u, job_type, mode, job_flags, reterr_error); } -static int bus_unit_method_start(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_unit_method_start_generic(message, userdata, JOB_START, false, error); +static int bus_unit_method_start(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_unit_method_start_generic(message, userdata, JOB_START, false, reterr_error); } -static int bus_unit_method_stop(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_unit_method_start_generic(message, userdata, JOB_STOP, false, error); +static int bus_unit_method_stop(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_unit_method_start_generic(message, userdata, JOB_STOP, false, reterr_error); } -static int bus_unit_method_reload(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_unit_method_start_generic(message, userdata, JOB_RELOAD, false, error); +static int bus_unit_method_reload(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_unit_method_start_generic(message, userdata, JOB_RELOAD, false, reterr_error); } -static int bus_unit_method_restart(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_unit_method_start_generic(message, userdata, JOB_RESTART, false, error); +static int bus_unit_method_restart(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_unit_method_start_generic(message, userdata, JOB_RESTART, false, reterr_error); } -static int bus_unit_method_try_restart(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_unit_method_start_generic(message, userdata, JOB_TRY_RESTART, false, error); +static int bus_unit_method_try_restart(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_unit_method_start_generic(message, userdata, JOB_TRY_RESTART, false, reterr_error); } -static int bus_unit_method_reload_or_restart(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_unit_method_start_generic(message, userdata, JOB_RESTART, true, error); +static int bus_unit_method_reload_or_restart(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_unit_method_start_generic(message, userdata, JOB_RESTART, true, reterr_error); } -static int bus_unit_method_reload_or_try_restart(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_unit_method_start_generic(message, userdata, JOB_TRY_RESTART, true, error); +static int bus_unit_method_reload_or_try_restart(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_unit_method_start_generic(message, userdata, JOB_TRY_RESTART, true, reterr_error); } -int bus_unit_method_enqueue_job(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_enqueue_job(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { BusUnitQueueFlags flags = BUS_UNIT_QUEUE_VERBOSE_REPLY; const char *jtype, *smode; Unit *u = ASSERT_PTR(userdata); @@ -491,17 +491,17 @@ int bus_unit_method_enqueue_job(sd_bus_message *message, void *userdata, sd_bus_ /* And the rest generically */ type = job_type_from_string(jtype); if (type < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Job type %s invalid", jtype); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Job type %s invalid", jtype); } mode = job_mode_from_string(smode); if (mode < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s invalid", smode); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s invalid", smode); r = mac_selinux_unit_access_check( u, message, job_type_to_access_method(type), - error); + reterr_error); if (r < 0) return r; @@ -510,16 +510,16 @@ int bus_unit_method_enqueue_job(sd_bus_message *message, void *userdata, sd_bus_ jtype, polkit_message_for_job[type], message, - error); + reterr_error); if (r < 0) return r; if (r == 0) return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ - return bus_unit_queue_job(message, u, type, mode, flags, error); + return bus_unit_queue_job(message, u, type, mode, flags, reterr_error); } -int bus_unit_method_kill(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_kill(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); int32_t value = 0; const char *swhom; @@ -529,7 +529,7 @@ int bus_unit_method_kill(sd_bus_message *message, void *userdata, sd_bus_error * assert(message); - r = mac_selinux_unit_access_check(u, message, "stop", error); + r = mac_selinux_unit_access_check(u, message, "stop", reterr_error); if (r < 0) return r; @@ -551,14 +551,14 @@ int bus_unit_method_kill(sd_bus_message *message, void *userdata, sd_bus_error * else { whom = kill_whom_from_string(swhom); if (whom < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid whom argument: %s", swhom); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid whom argument: %s", swhom); } if (!SIGNAL_VALID(signo)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Signal number out of range."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Signal number out of range."); if (code == SI_QUEUE && !((signo >= SIGRTMIN) && (signo <= SIGRTMAX))) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Value parameter only accepted for realtime signals (SIGRTMIN…SIGRTMAX), refusing for signal SIG%s.", signal_to_string(signo)); r = bus_verify_manage_units_async_full( @@ -566,26 +566,26 @@ int bus_unit_method_kill(sd_bus_message *message, void *userdata, sd_bus_error * "kill", N_("Authentication is required to send a UNIX signal to the processes of '$(unit)'."), message, - error); + reterr_error); if (r < 0) return r; if (r == 0) return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ - r = unit_kill(u, whom, /* subgroup= */ NULL, signo, code, value, error); + r = unit_kill(u, whom, /* subgroup= */ NULL, signo, code, value, reterr_error); if (r < 0) return r; return sd_bus_reply_method_return(message, NULL); } -int bus_unit_method_kill_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_kill_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_unit_access_check(u, message, "stop", error); + r = mac_selinux_unit_access_check(u, message, "stop", reterr_error); if (r < 0) return r; @@ -601,44 +601,44 @@ int bus_unit_method_kill_subgroup(sd_bus_message *message, void *userdata, sd_bu else { whom = kill_whom_from_string(swhom); if (whom < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid whom argument: %s", swhom); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid whom argument: %s", swhom); } if (isempty(subgroup)) subgroup = NULL; else if (!path_is_normalized(subgroup)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Specified cgroup sub-path is not valid."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Specified cgroup sub-path is not valid."); else if (!IN_SET(whom, KILL_CGROUP, KILL_CGROUP_FAIL)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Subgroup can only be specified in combination with 'cgroup' or 'cgroup-fail'."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Subgroup can only be specified in combination with 'cgroup' or 'cgroup-fail'."); if (!SIGNAL_VALID(signo)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Signal number out of range."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Signal number out of range."); r = bus_verify_manage_units_async_full( u, "kill-subgroup", N_("Authentication is required to send a UNIX signal to the processes of subgroup of '$(unit)'."), message, - error); + reterr_error); if (r < 0) return r; if (r == 0) return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ - r = unit_kill(u, whom, subgroup, signo, SI_USER, /* value= */ 0, error); + r = unit_kill(u, whom, subgroup, signo, SI_USER, /* value= */ 0, reterr_error); if (r < 0) return r; return sd_bus_reply_method_return(message, NULL); } -int bus_unit_method_reset_failed(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_reset_failed(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_unit_access_check(u, message, "reload", error); + r = mac_selinux_unit_access_check(u, message, "reload", reterr_error); if (r < 0) return r; @@ -647,7 +647,7 @@ int bus_unit_method_reset_failed(sd_bus_message *message, void *userdata, sd_bus "reset-failed", N_("Authentication is required to reset the \"failed\" state of '$(unit)'."), message, - error); + reterr_error); if (r < 0) return r; if (r == 0) @@ -658,13 +658,13 @@ int bus_unit_method_reset_failed(sd_bus_message *message, void *userdata, sd_bus return sd_bus_reply_method_return(message, NULL); } -int bus_unit_method_set_properties(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_set_properties(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); int runtime, r; assert(message); - r = mac_selinux_unit_access_check(u, message, "start", error); + r = mac_selinux_unit_access_check(u, message, "start", reterr_error); if (r < 0) return r; @@ -677,26 +677,26 @@ int bus_unit_method_set_properties(sd_bus_message *message, void *userdata, sd_b "set-property", N_("Authentication is required to set properties on '$(unit)'."), message, - error); + reterr_error); if (r < 0) return r; if (r == 0) return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ - r = bus_unit_set_properties(u, message, runtime ? UNIT_RUNTIME : UNIT_PERSISTENT, true, error); + r = bus_unit_set_properties(u, message, runtime ? UNIT_RUNTIME : UNIT_PERSISTENT, true, reterr_error); if (r < 0) return r; return sd_bus_reply_method_return(message, NULL); } -int bus_unit_method_ref(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_ref(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_unit_access_check(u, message, "start", error); + r = mac_selinux_unit_access_check(u, message, "start", reterr_error); if (r < 0) return r; @@ -705,7 +705,7 @@ int bus_unit_method_ref(sd_bus_message *message, void *userdata, sd_bus_error *e "ref", /* polkit_message= */ NULL, message, - error); + reterr_error); if (r < 0) return r; if (r == 0) @@ -718,7 +718,7 @@ int bus_unit_method_ref(sd_bus_message *message, void *userdata, sd_bus_error *e return sd_bus_reply_method_return(message, NULL); } -int bus_unit_method_unref(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_unref(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); int r; @@ -726,21 +726,21 @@ int bus_unit_method_unref(sd_bus_message *message, void *userdata, sd_bus_error r = bus_unit_track_remove_sender(u, message); if (r == -EUNATCH) - return sd_bus_error_set(error, BUS_ERROR_NOT_REFERENCED, "Unit has not been referenced yet."); + return sd_bus_error_set(reterr_error, BUS_ERROR_NOT_REFERENCED, "Unit has not been referenced yet."); if (r < 0) return r; return sd_bus_reply_method_return(message, NULL); } -int bus_unit_method_clean(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_clean(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { ExecCleanMask mask = 0; Unit *u = ASSERT_PTR(userdata); int r; assert(message); - r = mac_selinux_unit_access_check(u, message, "stop", error); + r = mac_selinux_unit_access_check(u, message, "stop", reterr_error); if (r < 0) return r; @@ -760,7 +760,7 @@ int bus_unit_method_clean(sd_bus_message *message, void *userdata, sd_bus_error m = exec_clean_mask_from_string(i); if (m < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid resource type: %s", i); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid resource type: %s", i); mask |= m; } @@ -774,7 +774,7 @@ int bus_unit_method_clean(sd_bus_message *message, void *userdata, sd_bus_error "clean", N_("Authentication is required to delete files and directories associated with '$(unit)'."), message, - error); + reterr_error); if (r < 0) return r; if (r == 0) @@ -782,18 +782,18 @@ int bus_unit_method_clean(sd_bus_message *message, void *userdata, sd_bus_error r = unit_clean(u, mask); if (r == -EOPNOTSUPP) - return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Unit '%s' does not support cleaning.", u->id); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Unit '%s' does not support cleaning.", u->id); if (r == -EUNATCH) - return sd_bus_error_set(error, BUS_ERROR_NOTHING_TO_CLEAN, "No matching resources found."); + return sd_bus_error_set(reterr_error, BUS_ERROR_NOTHING_TO_CLEAN, "No matching resources found."); if (r == -EBUSY) - return sd_bus_error_set(error, BUS_ERROR_UNIT_BUSY, "Unit is not inactive or has pending job."); + return sd_bus_error_set(reterr_error, BUS_ERROR_UNIT_BUSY, "Unit is not inactive or has pending job."); if (r < 0) return r; return sd_bus_reply_method_return(message, NULL); } -static int bus_unit_method_freezer_generic(sd_bus_message *message, void *userdata, sd_bus_error *error, FreezerAction action) { +static int bus_unit_method_freezer_generic(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error, FreezerAction action) { Unit *u = ASSERT_PTR(userdata); int r; @@ -802,7 +802,7 @@ static int bus_unit_method_freezer_generic(sd_bus_message *message, void *userda const char *perm = action == FREEZER_FREEZE ? "stop" : "start"; - r = mac_selinux_unit_access_check(u, message, perm, error); + r = mac_selinux_unit_access_check(u, message, perm, reterr_error); if (r < 0) return r; @@ -811,7 +811,7 @@ static int bus_unit_method_freezer_generic(sd_bus_message *message, void *userda perm, N_("Authentication is required to freeze or thaw the processes of '$(unit)' unit."), message, - error); + reterr_error); if (r < 0) return r; if (r == 0) @@ -819,15 +819,15 @@ static int bus_unit_method_freezer_generic(sd_bus_message *message, void *userda r = unit_freezer_action(u, action); if (r == -EOPNOTSUPP) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "Unit does not support freeze/thaw"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Unit does not support freeze/thaw"); if (r == -EBUSY) - return sd_bus_error_set(error, BUS_ERROR_UNIT_BUSY, "Unit has a pending job"); + return sd_bus_error_set(reterr_error, BUS_ERROR_UNIT_BUSY, "Unit has a pending job"); if (r == -EHOSTDOWN) - return sd_bus_error_set(error, BUS_ERROR_UNIT_INACTIVE, "Unit is not active"); + return sd_bus_error_set(reterr_error, BUS_ERROR_UNIT_INACTIVE, "Unit is not active"); if (r == -EALREADY) - return sd_bus_error_set(error, BUS_ERROR_UNIT_BUSY, "Previously requested freezer operation for unit is still in progress"); + return sd_bus_error_set(reterr_error, BUS_ERROR_UNIT_BUSY, "Previously requested freezer operation for unit is still in progress"); if (r == -EDEADLK) - return sd_bus_error_set(error, BUS_ERROR_FROZEN_BY_PARENT, "Unit is frozen by a parent slice"); + return sd_bus_error_set(reterr_error, BUS_ERROR_FROZEN_BY_PARENT, "Unit is frozen by a parent slice"); if (r < 0) return r; @@ -849,12 +849,12 @@ static int bus_unit_method_freezer_generic(sd_bus_message *message, void *userda return 1; } -int bus_unit_method_thaw(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_unit_method_freezer_generic(message, userdata, error, FREEZER_THAW); +int bus_unit_method_thaw(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_unit_method_freezer_generic(message, userdata, reterr_error, FREEZER_THAW); } -int bus_unit_method_freeze(sd_bus_message *message, void *userdata, sd_bus_error *error) { - return bus_unit_method_freezer_generic(message, userdata, error, FREEZER_FREEZE); +int bus_unit_method_freeze(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { + return bus_unit_method_freezer_generic(message, userdata, reterr_error, FREEZER_FREEZE); } static int property_get_refs( @@ -864,7 +864,7 @@ static int property_get_refs( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = userdata; int r; @@ -1104,7 +1104,7 @@ static int property_get_slice( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); @@ -1121,7 +1121,7 @@ static int property_get_available_memory( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t sz = UINT64_MAX; Unit *u = ASSERT_PTR(userdata); @@ -1144,7 +1144,7 @@ static int property_get_memory_accounting( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); CGroupMemoryAccountingMetric metric; @@ -1165,7 +1165,7 @@ static int property_get_current_tasks( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t cn = UINT64_MAX; Unit *u = ASSERT_PTR(userdata); @@ -1188,7 +1188,7 @@ static int property_get_cpu_usage( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { nsec_t ns = NSEC_INFINITY; Unit *u = ASSERT_PTR(userdata); @@ -1211,7 +1211,7 @@ static int property_get_cpuset_cpus( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); _cleanup_(cpu_set_done) CPUSet cpus = {}; @@ -1233,7 +1233,7 @@ static int property_get_cpuset_mems( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); _cleanup_(cpu_set_done) CPUSet mems = {}; @@ -1255,7 +1255,7 @@ static int property_get_cgroup( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); const char *t = NULL; @@ -1284,7 +1284,7 @@ static int property_get_cgroup_id( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); @@ -1302,7 +1302,7 @@ static int property_get_oom_kills( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); @@ -1320,7 +1320,7 @@ static int property_get_managed_oom_kills( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); @@ -1438,7 +1438,7 @@ static int append_cgroup(sd_bus_message *reply, const char *p, Set *pids) { return 0; } -int bus_unit_method_get_processes(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_get_processes(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; _cleanup_set_free_ Set *pids = NULL; Unit *u = userdata; @@ -1446,7 +1446,7 @@ int bus_unit_method_get_processes(sd_bus_message *message, void *userdata, sd_bu assert(message); - r = mac_selinux_unit_access_check(u, message, "status", error); + r = mac_selinux_unit_access_check(u, message, "status", reterr_error); if (r < 0) return r; @@ -1498,7 +1498,7 @@ static int property_get_ip_counter( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t value = UINT64_MAX; Unit *u = ASSERT_PTR(userdata); @@ -1520,7 +1520,7 @@ static int property_get_io_counter( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t value = UINT64_MAX; Unit *u = ASSERT_PTR(userdata); @@ -1542,7 +1542,7 @@ static int property_get_effective_limit( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t value = CGROUP_LIMIT_MAX; Unit *u = ASSERT_PTR(userdata); @@ -1557,7 +1557,7 @@ static int property_get_effective_limit( return sd_bus_message_append(reply, "t", value); } -int bus_unit_method_attach_processes(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_attach_processes(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL; _cleanup_set_free_ Set *pids = NULL; Unit *u = userdata; @@ -1571,7 +1571,7 @@ int bus_unit_method_attach_processes(sd_bus_message *message, void *userdata, sd * representation. If a process is already in the cgroup no operation is executed – in this case the specified * subcgroup path has no effect! */ - r = mac_selinux_unit_access_check(u, message, "start", error); + r = mac_selinux_unit_access_check(u, message, "start", reterr_error); if (r < 0) return r; @@ -1582,17 +1582,17 @@ int bus_unit_method_attach_processes(sd_bus_message *message, void *userdata, sd path = empty_to_null(path); if (path) { if (!path_is_absolute(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not absolute: %s", path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not absolute: %s", path); if (!path_is_normalized(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not normalized: %s", path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not normalized: %s", path); } if (!unit_cgroup_delegate(u)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Process migration not available on non-delegated units."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Process migration not available on non-delegated units."); if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(u))) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Unit is not active, refusing."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unit is not active, refusing."); r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_EUID|SD_BUS_CREDS_PID|SD_BUS_CREDS_PIDFD, &creds); if (r < 0) @@ -1629,7 +1629,7 @@ int bus_unit_method_attach_processes(sd_bus_message *message, void *userdata, sd continue; /* Check if this process is suitable for attaching to this unit */ - r = unit_pid_attachable(u, pidref, error); + r = unit_pid_attachable(u, pidref, reterr_error); if (r < 0) return r; @@ -1645,15 +1645,15 @@ int bus_unit_method_attach_processes(sd_bus_message *message, void *userdata, sd if (sender_uid != 0 && sender_uid != getuid()) { r = process_is_owned_by_uid(pidref, sender_uid); if (r < 0) - return sd_bus_error_set_errnof(error, r, "Failed to check if process " PID_FMT " is owned by client's UID: %m", pidref->pid); + return sd_bus_error_set_errnof(reterr_error, r, "Failed to check if process " PID_FMT " is owned by client's UID: %m", pidref->pid); if (r == 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Process " PID_FMT " not owned by client's UID. Refusing.", pidref->pid); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_ACCESS_DENIED, "Process " PID_FMT " not owned by client's UID. Refusing.", pidref->pid); r = process_is_owned_by_uid(pidref, u->ref_uid); if (r < 0) - return sd_bus_error_set_errnof(error, r, "Failed to check if process " PID_FMT " is owned by target unit's UID: %m", pidref->pid); + return sd_bus_error_set_errnof(reterr_error, r, "Failed to check if process " PID_FMT " is owned by target unit's UID: %m", pidref->pid); if (r == 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Process " PID_FMT " not owned by target unit's UID. Refusing.", pidref->pid); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_ACCESS_DENIED, "Process " PID_FMT " not owned by target unit's UID. Refusing.", pidref->pid); } r = set_ensure_consume(&pids, &pidref_hash_ops_free, TAKE_PTR(pidref)); @@ -1667,12 +1667,12 @@ int bus_unit_method_attach_processes(sd_bus_message *message, void *userdata, sd r = unit_attach_pids_to_cgroup(u, pids, path); if (r < 0) - return sd_bus_error_set_errnof(error, r, "Failed to attach processes to control group: %m"); + return sd_bus_error_set_errnof(reterr_error, r, "Failed to attach processes to control group: %m"); return sd_bus_reply_method_return(message, NULL); } -int bus_unit_method_remove_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *error) { +int bus_unit_method_remove_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); int r; @@ -1681,7 +1681,7 @@ int bus_unit_method_remove_subgroup(sd_bus_message *message, void *userdata, sd_ /* This removes a subcgroup of the unit, regardless which user owns the subcgroup. This is useful * when cgroup delegation is enabled for a unit, and the unit subdelegates the cgroup further */ - r = mac_selinux_unit_access_check(u, message, "stop", error); + r = mac_selinux_unit_access_check(u, message, "stop", reterr_error); if (r < 0) return r; @@ -1696,13 +1696,13 @@ int bus_unit_method_remove_subgroup(sd_bus_message *message, void *userdata, sd_ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid 'flags' parameter '%" PRIu64 "'", flags); if (!unit_cgroup_delegate(u)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Subcgroup removal not available on non-delegated units."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Subcgroup removal not available on non-delegated units."); if (!path_is_absolute(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not absolute: %s", path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not absolute: %s", path); if (!path_is_normalized(path)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not normalized: %s", path); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not normalized: %s", path); _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL; r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_EUID, &creds); @@ -1716,11 +1716,11 @@ int bus_unit_method_remove_subgroup(sd_bus_message *message, void *userdata, sd_ /* Allow this only if the client is privileged, is us, or is the user of the unit itself. */ if (sender_uid != 0 && sender_uid != getuid() && sender_uid != u->ref_uid) - return sd_bus_error_set(error, SD_BUS_ERROR_ACCESS_DENIED, "Client is not permitted to alter cgroup."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_ACCESS_DENIED, "Client is not permitted to alter cgroup."); r = unit_remove_subcgroup(u, path); if (r < 0) - return sd_bus_error_set_errnof(error, r, "Failed to remove subgroup %s: %m", path); + return sd_bus_error_set_errnof(reterr_error, r, "Failed to remove subgroup %s: %m", path); return sd_bus_reply_method_return(message, NULL); } @@ -1953,7 +1953,7 @@ int bus_unit_queue_job_one( JobMode mode, BusUnitQueueFlags flags, sd_bus_message *reply, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_set_free_ Set *affected = NULL; _cleanup_free_ char *job_path = NULL, *unit_path = NULL; @@ -1968,13 +1968,13 @@ int bus_unit_queue_job_one( } if (type == JOB_STOP && UNIT_IS_LOAD_ERROR(u->load_state) && unit_active_state(u) == UNIT_INACTIVE) - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s not loaded.", u->id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s not loaded.", u->id); if ((type == JOB_START && u->refuse_manual_start) || (type == JOB_STOP && u->refuse_manual_stop) || (IN_SET(type, JOB_RESTART, JOB_TRY_RESTART) && (u->refuse_manual_start || u->refuse_manual_stop)) || (type == JOB_RELOAD_OR_START && job_type_collapse(type, u) == JOB_START && u->refuse_manual_start)) - return sd_bus_error_setf(error, + return sd_bus_error_setf(reterr_error, BUS_ERROR_ONLY_BY_DEPENDENCY, "Operation refused, unit %s may be requested by dependency only (it is configured to refuse manual start/stop).", u->id); @@ -1993,7 +1993,7 @@ int bus_unit_queue_job_one( dbus = manager_get_unit(u->manager, dbus_unit); if (dbus && unit_stop_pending(dbus)) - return sd_bus_error_setf(error, + return sd_bus_error_setf(reterr_error, BUS_ERROR_SHUTTING_DOWN, "Operation for unit %s refused, D-Bus is shutting down.", u->id); @@ -2005,7 +2005,7 @@ int bus_unit_queue_job_one( return -ENOMEM; } - r = manager_add_job_full(u->manager, type, u, mode, /* extra_flags = */ 0, affected, error, &j); + r = manager_add_job_full(u->manager, type, u, mode, /* extra_flags = */ 0, affected, reterr_error, &j); if (r < 0) return r; @@ -2074,7 +2074,7 @@ int bus_unit_queue_job( JobType type, JobMode mode, BusUnitQueueFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; int r; @@ -2087,7 +2087,7 @@ int bus_unit_queue_job( r = mac_selinux_unit_access_check( u, message, job_type_to_access_method(type), - error); + reterr_error); if (r < 0) return r; @@ -2095,7 +2095,7 @@ int bus_unit_queue_job( if (r < 0) return r; - r = bus_unit_queue_job_one(message, u, type, mode, flags, reply, error); + r = bus_unit_queue_job_one(message, u, type, mode, flags, reply, reterr_error); if (r < 0) return r; @@ -2107,7 +2107,7 @@ static int bus_unit_set_live_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { int r; @@ -2169,7 +2169,7 @@ static int bus_unit_set_live_property( UnitMarker m = unit_marker_from_string(word); if (m < 0) - return sd_bus_error_setf(error, BUS_ERROR_BAD_UNIT_SETTING, + return sd_bus_error_setf(reterr_error, BUS_ERROR_BAD_UNIT_SETTING, "Unknown marker \"%s\".", word); SET_FLAG(settings, 1u << m, b); @@ -2181,7 +2181,7 @@ static int bus_unit_set_live_property( return r; if (some_plus_minus && some_absolute) - return sd_bus_error_set(error, BUS_ERROR_BAD_UNIT_SETTING, "Bad marker syntax."); + return sd_bus_error_set(reterr_error, BUS_ERROR_BAD_UNIT_SETTING, "Bad marker syntax."); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { if (some_absolute) @@ -2202,7 +2202,7 @@ static int bus_set_transient_emergency_action( EmergencyAction *p, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { const char *s; EmergencyAction v; @@ -2216,7 +2216,7 @@ static int bus_set_transient_emergency_action( r = parse_emergency_action(s, u->manager->runtime_scope, &v); if (r < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, r == -EOPNOTSUPP ? "%s setting invalid for manager type: %s" : "Invalid %s setting: %s", name, s); @@ -2236,7 +2236,7 @@ static int bus_set_transient_exit_status( int *p, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { int32_t k; int r; @@ -2248,7 +2248,7 @@ static int bus_set_transient_exit_status( return r; if (k > 255) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Exit status must be in range 0…255 or negative."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Exit status must be in range 0…255 or negative."); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { *p = k < 0 ? -1 : k; @@ -2272,7 +2272,7 @@ static int bus_set_transient_conditions( bool is_condition, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { const char *type_name, *param; int trigger, negate, r; @@ -2289,13 +2289,13 @@ static int bus_set_transient_conditions( t = is_condition ? condition_type_from_string(type_name) : assert_type_from_string(type_name); if (t < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid condition type: %s", type_name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid condition type: %s", type_name); if (isempty(param)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Condition parameter in %s is empty", type_name); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Condition parameter in %s is empty", type_name); if (condition_takes_path(t) && !path_is_absolute(param)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path in condition %s is not absolute: %s", type_name, param); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path in condition %s is not absolute: %s", type_name, param); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { Condition *c; @@ -2333,7 +2333,7 @@ static int bus_unit_set_transient_property( const char *name, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { UnitDependency d; int r; @@ -2346,43 +2346,43 @@ static int bus_unit_set_transient_property( * the unit has been created. */ if (streq(name, "SourcePath")) - return bus_set_transient_path(u, name, &u->source_path, message, flags, error); + return bus_set_transient_path(u, name, &u->source_path, message, flags, reterr_error); if (streq(name, "StopWhenUnneeded")) - return bus_set_transient_bool(u, name, &u->stop_when_unneeded, message, flags, error); + return bus_set_transient_bool(u, name, &u->stop_when_unneeded, message, flags, reterr_error); if (streq(name, "RefuseManualStart")) - return bus_set_transient_bool(u, name, &u->refuse_manual_start, message, flags, error); + return bus_set_transient_bool(u, name, &u->refuse_manual_start, message, flags, reterr_error); if (streq(name, "RefuseManualStop")) - return bus_set_transient_bool(u, name, &u->refuse_manual_stop, message, flags, error); + return bus_set_transient_bool(u, name, &u->refuse_manual_stop, message, flags, reterr_error); if (streq(name, "AllowIsolate")) - return bus_set_transient_bool(u, name, &u->allow_isolate, message, flags, error); + return bus_set_transient_bool(u, name, &u->allow_isolate, message, flags, reterr_error); if (streq(name, "DefaultDependencies")) - return bus_set_transient_bool(u, name, &u->default_dependencies, message, flags, error); + return bus_set_transient_bool(u, name, &u->default_dependencies, message, flags, reterr_error); if (streq(name, "SurviveFinalKillSignal")) - return bus_set_transient_bool(u, name, &u->survive_final_kill_signal, message, flags, error); + return bus_set_transient_bool(u, name, &u->survive_final_kill_signal, message, flags, reterr_error); if (streq(name, "OnSuccessJobMode")) - return bus_set_transient_job_mode(u, name, &u->on_success_job_mode, message, flags, error); + return bus_set_transient_job_mode(u, name, &u->on_success_job_mode, message, flags, reterr_error); if (streq(name, "OnFailureJobMode")) - return bus_set_transient_job_mode(u, name, &u->on_failure_job_mode, message, flags, error); + return bus_set_transient_job_mode(u, name, &u->on_failure_job_mode, message, flags, reterr_error); if (streq(name, "IgnoreOnIsolate")) - return bus_set_transient_bool(u, name, &u->ignore_on_isolate, message, flags, error); + return bus_set_transient_bool(u, name, &u->ignore_on_isolate, message, flags, reterr_error); if (streq(name, "JobTimeoutUSec")) { - r = bus_set_transient_usec_fix_0(u, name, &u->job_timeout, message, flags, error); + r = bus_set_transient_usec_fix_0(u, name, &u->job_timeout, message, flags, reterr_error); if (r >= 0 && !UNIT_WRITE_FLAGS_NOOP(flags) && !u->job_running_timeout_set) u->job_running_timeout = u->job_timeout; } if (streq(name, "JobRunningTimeoutUSec")) { - r = bus_set_transient_usec_fix_0(u, name, &u->job_running_timeout, message, flags, error); + r = bus_set_transient_usec_fix_0(u, name, &u->job_running_timeout, message, flags, reterr_error); if (r >= 0 && !UNIT_WRITE_FLAGS_NOOP(flags)) u->job_running_timeout_set = true; @@ -2390,43 +2390,43 @@ static int bus_unit_set_transient_property( } if (streq(name, "JobTimeoutAction")) - return bus_set_transient_emergency_action(u, name, &u->job_timeout_action, message, flags, error); + return bus_set_transient_emergency_action(u, name, &u->job_timeout_action, message, flags, reterr_error); if (streq(name, "JobTimeoutRebootArgument")) - return bus_set_transient_reboot_parameter(u, name, &u->job_timeout_reboot_arg, message, flags, error); + return bus_set_transient_reboot_parameter(u, name, &u->job_timeout_reboot_arg, message, flags, reterr_error); if (streq(name, "StartLimitIntervalUSec")) - return bus_set_transient_usec(u, name, &u->start_ratelimit.interval, message, flags, error); + return bus_set_transient_usec(u, name, &u->start_ratelimit.interval, message, flags, reterr_error); if (streq(name, "StartLimitBurst")) - return bus_set_transient_unsigned(u, name, &u->start_ratelimit.burst, message, flags, error); + return bus_set_transient_unsigned(u, name, &u->start_ratelimit.burst, message, flags, reterr_error); if (streq(name, "StartLimitAction")) - return bus_set_transient_emergency_action(u, name, &u->start_limit_action, message, flags, error); + return bus_set_transient_emergency_action(u, name, &u->start_limit_action, message, flags, reterr_error); if (streq(name, "FailureAction")) - return bus_set_transient_emergency_action(u, name, &u->failure_action, message, flags, error); + return bus_set_transient_emergency_action(u, name, &u->failure_action, message, flags, reterr_error); if (streq(name, "SuccessAction")) - return bus_set_transient_emergency_action(u, name, &u->success_action, message, flags, error); + return bus_set_transient_emergency_action(u, name, &u->success_action, message, flags, reterr_error); if (streq(name, "FailureActionExitStatus")) - return bus_set_transient_exit_status(u, name, &u->failure_action_exit_status, message, flags, error); + return bus_set_transient_exit_status(u, name, &u->failure_action_exit_status, message, flags, reterr_error); if (streq(name, "SuccessActionExitStatus")) - return bus_set_transient_exit_status(u, name, &u->success_action_exit_status, message, flags, error); + return bus_set_transient_exit_status(u, name, &u->success_action_exit_status, message, flags, reterr_error); if (streq(name, "RebootArgument")) - return bus_set_transient_reboot_parameter(u, name, &u->reboot_arg, message, flags, error); + return bus_set_transient_reboot_parameter(u, name, &u->reboot_arg, message, flags, reterr_error); if (streq(name, "CollectMode")) - return bus_set_transient_collect_mode(u, name, &u->collect_mode, message, flags, error); + return bus_set_transient_collect_mode(u, name, &u->collect_mode, message, flags, reterr_error); if (streq(name, "Conditions")) - return bus_set_transient_conditions(u, name, &u->conditions, true, message, flags, error); + return bus_set_transient_conditions(u, name, &u->conditions, true, message, flags, reterr_error); if (streq(name, "Asserts")) - return bus_set_transient_conditions(u, name, &u->asserts, false, message, flags, error); + return bus_set_transient_conditions(u, name, &u->asserts, false, message, flags, reterr_error); if (streq(name, "Documentation")) { _cleanup_strv_free_ char **l = NULL; @@ -2437,7 +2437,7 @@ static int bus_unit_set_transient_property( STRV_FOREACH(p, l) if (!documentation_url_is_valid(*p)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid URL in %s: %s", name, *p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid URL in %s: %s", name, *p); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { if (strv_isempty(l)) { @@ -2461,28 +2461,28 @@ static int bus_unit_set_transient_property( const char *s; if (!UNIT_HAS_CGROUP_CONTEXT(u)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "The slice property is only available for units with control groups."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "The slice property is only available for units with control groups."); if (u->type == UNIT_SLICE) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Slice may not be set for slice units."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Slice may not be set for slice units."); if (unit_has_name(u, SPECIAL_INIT_SCOPE)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Cannot set slice for init.scope"); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Cannot set slice for init.scope"); r = sd_bus_message_read(message, "s", &s); if (r < 0) return r; if (!unit_name_is_valid(s, UNIT_NAME_PLAIN)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit name '%s'", s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit name '%s'", s); /* Note that we do not dispatch the load queue here yet, as we don't want our own transient unit to be * loaded while we are still setting it up. Or in other words, we use manager_load_unit_prepare() * instead of manager_load_unit() on purpose, here. */ - r = manager_load_unit_prepare(u->manager, s, NULL, error, &slice); + r = manager_load_unit_prepare(u->manager, s, NULL, reterr_error, &slice); if (r < 0) return r; if (slice->type != UNIT_SLICE) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unit name '%s' is not a slice", s); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unit name '%s' is not a slice", s); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = unit_set_slice(u, slice); @@ -2506,18 +2506,18 @@ static int bus_unit_set_transient_property( path_simplify(*p); if (!path_is_absolute(*p)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path specified in %s is not absolute: %s", name, *p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path specified in %s is not absolute: %s", name, *p); if (!path_is_valid(*p)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path specified in %s has invalid length: %s", name, *p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path specified in %s has invalid length: %s", name, *p); if (!path_is_normalized(*p)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path specified in %s is not normalized: %s", name, *p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Path specified in %s is not normalized: %s", name, *p); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = unit_add_mounts_for(u, *p, UNIT_DEPENDENCY_FILE, unit_mount_dependency_type_from_string(name)); if (r < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Failed to add requested mount \"%s\": %m", *p); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Failed to add requested mount \"%s\": %m", *p); unit_write_settingf(u, flags, name, "%s=%s", name, *p); } @@ -2575,7 +2575,7 @@ static int bus_unit_set_transient_property( UNIT_PROPAGATES_STOP_TO, UNIT_STOP_PROPAGATED_FROM, UNIT_JOINS_NAMESPACE_OF)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Dependency type %s may not be created transiently.", unit_dependency_to_string(d)); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Dependency type %s may not be created transiently.", unit_dependency_to_string(d)); r = sd_bus_message_enter_container(message, 'a', "s"); if (r < 0) @@ -2583,7 +2583,7 @@ static int bus_unit_set_transient_property( while ((r = sd_bus_message_read(message, "s", &other)) > 0) { if (!unit_name_is_valid(other, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit name %s", other); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit name %s", other); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *label = NULL; @@ -2618,7 +2618,7 @@ int bus_unit_set_properties( sd_bus_message *message, UnitWriteFlags flags, bool commit, - sd_bus_error *error) { + sd_bus_error *reterr_error) { bool for_real = false; unsigned n = 0; @@ -2667,18 +2667,18 @@ int bus_unit_set_properties( f = for_real ? flags : (flags & ~(UNIT_RUNTIME|UNIT_PERSISTENT)); if (UNIT_VTABLE(u)->bus_set_property) - r = UNIT_VTABLE(u)->bus_set_property(u, name, message, f, error); + r = UNIT_VTABLE(u)->bus_set_property(u, name, message, f, reterr_error); else r = 0; if (r == 0 && u->transient && u->load_state == UNIT_STUB) - r = bus_unit_set_transient_property(u, name, message, f, error); + r = bus_unit_set_transient_property(u, name, message, f, reterr_error); if (r == 0) - r = bus_unit_set_live_property(u, name, message, f, error); + r = bus_unit_set_live_property(u, name, message, f, reterr_error); if (r < 0) goto error; if (r == 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_PROPERTY_READ_ONLY, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_PROPERTY_READ_ONLY, "Cannot set property %s, or unknown property.", name); r = sd_bus_message_exit_container(message); @@ -2704,14 +2704,14 @@ int bus_unit_set_properties( error: /* Pretty much any of the calls above can fail if the message is not formed properly * or if it has unexpected contents. Fill in a more informative error message here. */ - if (sd_bus_error_is_set(error)) + if (sd_bus_error_is_set(reterr_error)) return r; - return sd_bus_error_set_errnof(error, r, + return sd_bus_error_set_errnof(reterr_error, r, r == -ENXIO ? "Failed to set unit properties: Unexpected message contents" : "Failed to set unit properties: %m"); } -int bus_unit_validate_load_state(Unit *u, sd_bus_error *error) { +int bus_unit_validate_load_state(Unit *u, sd_bus_error *reterr_error) { assert(u); /* Generates a pretty error if a unit isn't properly loaded. */ @@ -2722,22 +2722,22 @@ int bus_unit_validate_load_state(Unit *u, sd_bus_error *error) { return 0; case UNIT_NOT_FOUND: - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s not found.", u->id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s not found.", u->id); case UNIT_BAD_SETTING: - return sd_bus_error_setf(error, BUS_ERROR_BAD_UNIT_SETTING, "Unit %s has a bad unit file setting.", u->id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_BAD_UNIT_SETTING, "Unit %s has a bad unit file setting.", u->id); case UNIT_ERROR: /* Only show .load_error in UNIT_ERROR state */ - return sd_bus_error_set_errnof(error, u->load_error, + return sd_bus_error_set_errnof(reterr_error, u->load_error, "Unit %s failed to load properly, please adjust/correct and reload service manager: %m", u->id); case UNIT_MASKED: - return sd_bus_error_setf(error, BUS_ERROR_UNIT_MASKED, "Unit %s is masked.", u->id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_UNIT_MASKED, "Unit %s is masked.", u->id); case UNIT_STUB: case UNIT_MERGED: default: - return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Unexpected load state of unit %s", u->id); + return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_UNIT, "Unexpected load state of unit %s", u->id); } } diff --git a/src/core/dbus-unit.h b/src/core/dbus-unit.h index 97278931e0c..778f537672c 100644 --- a/src/core/dbus-unit.h +++ b/src/core/dbus-unit.h @@ -13,22 +13,22 @@ void bus_unit_send_pending_change_signal(Unit *u, bool including_new); int bus_unit_send_pending_freezer_message(Unit *u, bool canceled); void bus_unit_send_removed_signal(Unit *u); -int bus_unit_method_start_generic(sd_bus_message *message, Unit *u, JobType job_type, bool reload_if_possible, sd_bus_error *error); -int bus_unit_method_enqueue_job(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_kill(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_kill_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_reset_failed(sd_bus_message *message, void *userdata, sd_bus_error *error); - -int bus_unit_set_properties(Unit *u, sd_bus_message *message, UnitWriteFlags flags, bool commit, sd_bus_error *error); -int bus_unit_method_set_properties(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_get_processes(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_attach_processes(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_remove_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_ref(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_unref(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_clean(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_freeze(sd_bus_message *message, void *userdata, sd_bus_error *error); -int bus_unit_method_thaw(sd_bus_message *message, void *userdata, sd_bus_error *error); +int bus_unit_method_start_generic(sd_bus_message *message, Unit *u, JobType job_type, bool reload_if_possible, sd_bus_error *reterr_error); +int bus_unit_method_enqueue_job(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_kill(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_kill_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_reset_failed(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); + +int bus_unit_set_properties(Unit *u, sd_bus_message *message, UnitWriteFlags flags, bool commit, sd_bus_error *reterr_error); +int bus_unit_method_set_properties(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_get_processes(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_attach_processes(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_remove_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_ref(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_unref(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_clean(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_freeze(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); +int bus_unit_method_thaw(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error); typedef enum BusUnitQueueFlags { BUS_UNIT_QUEUE_RELOAD_IF_POSSIBLE = 1 << 0, @@ -42,15 +42,15 @@ int bus_unit_queue_job_one( JobMode mode, BusUnitQueueFlags flags, sd_bus_message *reply, - sd_bus_error *error); + sd_bus_error *reterr_error); int bus_unit_queue_job( sd_bus_message *message, Unit *u, JobType type, JobMode mode, BusUnitQueueFlags flags, - sd_bus_error *error); -int bus_unit_validate_load_state(Unit *u, sd_bus_error *error); + sd_bus_error *reterr_error); +int bus_unit_validate_load_state(Unit *u, sd_bus_error *reterr_error); int bus_unit_track_add_name(Unit *u, const char *name); int bus_unit_track_add_sender(Unit *u, sd_bus_message *m); diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c index 7db4434582a..74d559c6a32 100644 --- a/src/core/dbus-util.c +++ b/src/core/dbus-util.c @@ -18,7 +18,7 @@ int bus_property_get_triggered_unit( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Unit *u = userdata, *trigger; @@ -48,7 +48,7 @@ int bus_set_transient_string( char **p, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { const char *v; int r; @@ -77,7 +77,7 @@ int bus_set_transient_bool( bool *p, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { int v, r; @@ -101,7 +101,7 @@ int bus_set_transient_tristate( int *p, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { int v, r; @@ -126,7 +126,7 @@ static int bus_set_transient_usec_internal( bool fix_0, sd_bus_message *message, UnitWriteFlags flags, - sd_bus_error *error) { + sd_bus_error *reterr_error) { uint64_t v; int r; @@ -150,12 +150,12 @@ static int bus_set_transient_usec_internal( return 1; } -int bus_set_transient_usec(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { - return bus_set_transient_usec_internal(u, name, p, false, message, flags, error); +int bus_set_transient_usec(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error) { + return bus_set_transient_usec_internal(u, name, p, false, message, flags, reterr_error); } -int bus_set_transient_usec_fix_0(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { - return bus_set_transient_usec_internal(u, name, p, true, message, flags, error); +int bus_set_transient_usec_fix_0(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error) { + return bus_set_transient_usec_internal(u, name, p, true, message, flags, reterr_error); } int bus_verify_manage_units_async_impl( @@ -164,7 +164,7 @@ int bus_verify_manage_units_async_impl( const char *verb, const char *polkit_message, sd_bus_message *call, - sd_bus_error *error) { + sd_bus_error *reterr_error) { const char *details[9]; size_t n_details = 0; @@ -197,19 +197,19 @@ int bus_verify_manage_units_async_impl( "org.freedesktop.systemd1.manage-units", n_details > 0 ? details : NULL, &manager->polkit_registry, - error); + reterr_error); } -int bus_verify_manage_units_async_full(Unit *u, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *error) { +int bus_verify_manage_units_async_full(Unit *u, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *reterr_error) { assert(u); - return bus_verify_manage_units_async_impl(u->manager, u->id, verb, polkit_message, call, error); + return bus_verify_manage_units_async_impl(u->manager, u->id, verb, polkit_message, call, reterr_error); } -int bus_verify_manage_units_async(Manager *manager, sd_bus_message *call, sd_bus_error *error) { - return bus_verify_manage_units_async_impl(manager, NULL, NULL, NULL, call, error); +int bus_verify_manage_units_async(Manager *manager, sd_bus_message *call, sd_bus_error *reterr_error) { + return bus_verify_manage_units_async_impl(manager, NULL, NULL, NULL, call, reterr_error); } -int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *error) { +int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *reterr_error) { assert(m); assert(call); @@ -218,10 +218,10 @@ int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_ "org.freedesktop.systemd1.manage-unit-files", /* details= */ NULL, &m->polkit_registry, - error); + reterr_error); } -int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_error *error) { +int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_error *reterr_error) { assert(m); assert(call); @@ -229,10 +229,10 @@ int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_erro call, "org.freedesktop.systemd1.reload-daemon", /* details= */ NULL, - &m->polkit_registry, error); + &m->polkit_registry, reterr_error); } -int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_error *error) { +int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_error *reterr_error) { assert(m); assert(call); @@ -241,10 +241,10 @@ int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_er "org.freedesktop.systemd1.set-environment", /* details= */ NULL, &m->polkit_registry, - error); + reterr_error); } -int bus_verify_bypass_dump_ratelimit_async(Manager *m, sd_bus_message *call, sd_bus_error *error) { +int bus_verify_bypass_dump_ratelimit_async(Manager *m, sd_bus_message *call, sd_bus_error *reterr_error) { assert(m); assert(call); @@ -253,13 +253,13 @@ int bus_verify_bypass_dump_ratelimit_async(Manager *m, sd_bus_message *call, sd_ "org.freedesktop.systemd1.bypass-dump-ratelimit", /* details= */ NULL, &m->polkit_registry, - error); + reterr_error); } /* ret_format_str is an accumulator, so if it has any pre-existing content, new options will be appended to it */ int bus_read_mount_options( sd_bus_message *message, - sd_bus_error *error, + sd_bus_error *reterr_error, MountOptions **ret_options, char **ret_format_str, const char *separator) { @@ -283,12 +283,12 @@ int bus_read_mount_options( PartitionDesignator partition_designator; if (chars_intersect(mount_options, WHITESPACE)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid mount options string, contains whitespace character(s): %s", mount_options); partition_designator = partition_designator_from_string(partition); if (partition_designator < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid partition name %s", partition); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid partition name %s", partition); /* Need to store the options with the escapes, so that they can be parsed again */ escaped = shell_escape(mount_options, ":"); @@ -336,7 +336,7 @@ int bus_property_get_activation_details( const char *property, sd_bus_message *reply, void *userdata, - sd_bus_error *error) { + sd_bus_error *reterr_error) { ActivationDetails **details = ASSERT_PTR(userdata); _cleanup_strv_free_ char **pairs = NULL; diff --git a/src/core/dbus-util.h b/src/core/dbus-util.h index bccefdb58d4..5de3f988c7a 100644 --- a/src/core/dbus-util.h +++ b/src/core/dbus-util.h @@ -7,7 +7,14 @@ #include "string-util.h" #include "unit.h" -int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error); +int bus_property_get_triggered_unit( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *reterr_error); #define BUS_DEFINE_SET_TRANSIENT(function, bus_type, type, cast_type, fmt) \ int bus_set_transient_##function( \ @@ -16,7 +23,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i cast_type *p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ type v; \ int r; \ @@ -43,7 +50,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i cast_type *p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ type v; \ int r; \ @@ -55,7 +62,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i return r; \ \ if (!check(v)) \ - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \ + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, \ "Invalid %s setting: " fmt, name, v); \ \ if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \ @@ -74,7 +81,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i cast_type *p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ const char *s; \ type v; \ @@ -88,7 +95,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i \ s = to_string(v); \ if (!s) \ - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \ + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, \ "Invalid %s setting: " fmt, name, v); \ \ if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \ @@ -107,7 +114,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i cast_type *p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ _cleanup_free_ char *s = NULL; \ type v; \ @@ -121,7 +128,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i \ r = to_string(v, &s); \ if (r == -EINVAL) \ - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \ + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, \ "Invalid %s setting: " fmt, name, v); \ if (r < 0) \ return r; \ @@ -143,7 +150,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i type *p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ const char *s; \ type v; \ @@ -157,7 +164,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i \ v = parse(s); \ if (v < 0) \ - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \ + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, \ "Invalid %s setting: %s", name, s); \ \ if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \ @@ -176,7 +183,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i type *p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ const char *s; \ type v; \ @@ -190,7 +197,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i \ r = parse(s, &v); \ if (r < 0) \ - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \ + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, \ "Invalid %s setting: %s", name, s); \ \ if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \ @@ -209,7 +216,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i char **p, \ sd_bus_message *message, \ UnitWriteFlags flags, \ - sd_bus_error *error) { \ + sd_bus_error *reterr_error) { \ \ const char *v; \ int r; \ @@ -221,7 +228,7 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i return r; \ \ if (!isempty(v) && !check(v)) \ - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \ + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, \ "Invalid %s setting: %s", name, v); \ \ if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \ @@ -236,24 +243,24 @@ int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *i return 1; \ } -int bus_set_transient_mode_t(Unit *u, const char *name, mode_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_unsigned(Unit *u, const char *name, unsigned *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_user_relaxed(Unit *u, const char *name, char **p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_path(Unit *u, const char *name, char **p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_reboot_parameter(Unit *u, const char *name, char **p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_string(Unit *u, const char *name, char **p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_bool(Unit *u, const char *name, bool *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_tristate(Unit *u, const char *name, int *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_usec(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_set_transient_usec_fix_0(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); -int bus_verify_manage_units_async_impl(Manager *manager, const char *id, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *error); -int bus_verify_manage_units_async_full(Unit *u, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *error); -int bus_verify_manage_units_async(Manager *manager, sd_bus_message *call, sd_bus_error *error); -int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *error); -int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_error *error); -int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_error *error); -int bus_verify_bypass_dump_ratelimit_async(Manager *m, sd_bus_message *call, sd_bus_error *error); +int bus_set_transient_mode_t(Unit *u, const char *name, mode_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_set_transient_unsigned(Unit *u, const char *name, unsigned *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_set_transient_user_relaxed(Unit *u, const char *name, char **p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_set_transient_path(Unit *u, const char *name, char **p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_set_transient_reboot_parameter(Unit *u, const char *name, char **p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_set_transient_string(Unit *u, const char *name, char **p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_set_transient_bool(Unit *u, const char *name, bool *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_set_transient_tristate(Unit *u, const char *name, int *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_set_transient_usec(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_set_transient_usec_fix_0(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); +int bus_verify_manage_units_async_impl(Manager *manager, const char *id, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *reterr_error); +int bus_verify_manage_units_async_full(Unit *u, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *reterr_error); +int bus_verify_manage_units_async(Manager *manager, sd_bus_message *call, sd_bus_error *reterr_error); +int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *reterr_error); +int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_error *reterr_error); +int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_error *reterr_error); +int bus_verify_bypass_dump_ratelimit_async(Manager *m, sd_bus_message *call, sd_bus_error *reterr_error); -int bus_read_mount_options(sd_bus_message *message, sd_bus_error *error, MountOptions **ret_options, char **ret_format_str, const char *separator); +int bus_read_mount_options(sd_bus_message *message, sd_bus_error *reterr_error, MountOptions **ret_options, char **ret_format_str, const char *separator); -int bus_property_get_activation_details(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error); +int bus_property_get_activation_details(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *reterr_error); diff --git a/src/core/dbus.c b/src/core/dbus.c index 4d6623502d0..0ee35785846 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -71,7 +71,7 @@ void bus_send_pending_reload_message(Manager *m) { return; } -static int signal_disconnected(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int signal_disconnected(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); sd_bus *bus; @@ -161,7 +161,7 @@ failed: } #if HAVE_SELINUX -static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Manager *m = userdata; const char *verb, *path; Unit *u = NULL; @@ -189,7 +189,7 @@ static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_er return 0; if (object_path_startswith("/org/freedesktop/systemd1", path)) { - r = mac_selinux_access_check(message, verb, error); + r = mac_selinux_access_check(message, verb, reterr_error); if (r < 0) return r; @@ -214,7 +214,7 @@ static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_er if (!u) return 0; - r = mac_selinux_unit_access_check(u, message, verb, error); + r = mac_selinux_unit_access_check(u, message, verb, reterr_error); if (r < 0) return r; @@ -222,7 +222,7 @@ static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_er } #endif -static int find_unit(Manager *m, sd_bus *bus, const char *path, Unit **unit, sd_bus_error *error) { +static int find_unit(Manager *m, sd_bus *bus, const char *path, Unit **unit, sd_bus_error *reterr_error) { Unit *u = NULL; /* just to appease gcc, initialization is not really necessary */ int r; @@ -246,7 +246,7 @@ static int find_unit(Manager *m, sd_bus *bus, const char *path, Unit **unit, sd_ if (!u) return 0; } else { - r = manager_load_unit_from_dbus_path(m, path, error, &u); + r = manager_load_unit_from_dbus_path(m, path, reterr_error, &u); if (r < 0) return 0; assert(u); @@ -256,7 +256,7 @@ static int find_unit(Manager *m, sd_bus *bus, const char *path, Unit **unit, sd_ return 1; } -static int bus_unit_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) { +static int bus_unit_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); assert(bus); @@ -264,10 +264,10 @@ static int bus_unit_find(sd_bus *bus, const char *path, const char *interface, v assert(interface); assert(found); - return find_unit(m, bus, path, (Unit**) found, error); + return find_unit(m, bus, path, (Unit**) found, reterr_error); } -static int bus_unit_interface_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) { +static int bus_unit_interface_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); Unit *u; int r; @@ -277,7 +277,7 @@ static int bus_unit_interface_find(sd_bus *bus, const char *path, const char *in assert(interface); assert(found); - r = find_unit(m, bus, path, &u, error); + r = find_unit(m, bus, path, &u, reterr_error); if (r <= 0) return r; @@ -288,7 +288,7 @@ static int bus_unit_interface_find(sd_bus *bus, const char *path, const char *in return 1; } -static int bus_unit_cgroup_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) { +static int bus_unit_cgroup_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); Unit *u; int r; @@ -298,7 +298,7 @@ static int bus_unit_cgroup_find(sd_bus *bus, const char *path, const char *inter assert(interface); assert(found); - r = find_unit(m, bus, path, &u, error); + r = find_unit(m, bus, path, &u, reterr_error); if (r <= 0) return r; @@ -312,7 +312,7 @@ static int bus_unit_cgroup_find(sd_bus *bus, const char *path, const char *inter return 1; } -static int bus_cgroup_context_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) { +static int bus_cgroup_context_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); CGroupContext *c; Unit *u; @@ -323,7 +323,7 @@ static int bus_cgroup_context_find(sd_bus *bus, const char *path, const char *in assert(interface); assert(found); - r = find_unit(m, bus, path, &u, error); + r = find_unit(m, bus, path, &u, reterr_error); if (r <= 0) return r; @@ -338,7 +338,7 @@ static int bus_cgroup_context_find(sd_bus *bus, const char *path, const char *in return 1; } -static int bus_unit_exec_context_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) { +static int bus_unit_exec_context_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); Unit *u; int r; @@ -348,7 +348,7 @@ static int bus_unit_exec_context_find(sd_bus *bus, const char *path, const char assert(interface); assert(found); - r = find_unit(m, bus, path, &u, error); + r = find_unit(m, bus, path, &u, reterr_error); if (r <= 0) return r; @@ -362,7 +362,7 @@ static int bus_unit_exec_context_find(sd_bus *bus, const char *path, const char return 1; } -static int bus_exec_context_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) { +static int bus_exec_context_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *reterr_error) { ExecContext *c; int r; @@ -372,7 +372,7 @@ static int bus_exec_context_find(sd_bus *bus, const char *path, const char *inte assert(found); Unit *u; - r = bus_unit_exec_context_find(bus, path, interface, userdata, (void**) &u, error); + r = bus_unit_exec_context_find(bus, path, interface, userdata, (void**) &u, reterr_error); if (r <= 0) return r; @@ -384,7 +384,7 @@ static int bus_exec_context_find(sd_bus *bus, const char *path, const char *inte return 1; } -static int bus_kill_context_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) { +static int bus_kill_context_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *reterr_error) { Manager *m = ASSERT_PTR(userdata); KillContext *c; Unit *u; @@ -395,7 +395,7 @@ static int bus_kill_context_find(sd_bus *bus, const char *path, const char *inte assert(interface); assert(found); - r = find_unit(m, bus, path, &u, error); + r = find_unit(m, bus, path, &u, reterr_error); if (r <= 0) return r; @@ -410,7 +410,7 @@ static int bus_kill_context_find(sd_bus *bus, const char *path, const char *inte return 1; } -static int bus_unit_enumerate(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error) { +static int bus_unit_enumerate(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *reterr_error) { _cleanup_strv_free_ char **l = NULL; Manager *m = userdata; unsigned k = 0; diff --git a/src/core/manager.c b/src/core/manager.c index 192004554b5..c1c2b713ecc 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2132,7 +2132,7 @@ int manager_add_job_full( JobMode mode, TransactionAddFlags extra_flags, Set *affected_jobs, - sd_bus_error *error, + sd_bus_error *reterr_error, Job **ret) { _cleanup_(transaction_abort_and_freep) Transaction *tr = NULL; @@ -2145,16 +2145,16 @@ int manager_add_job_full( assert((extra_flags & ~_TRANSACTION_FLAGS_MASK_PUBLIC) == 0); if (mode == JOB_ISOLATE && type != JOB_START) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Isolate is only valid for start."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Isolate is only valid for start."); if (mode == JOB_ISOLATE && !unit->allow_isolate) - return sd_bus_error_set(error, BUS_ERROR_NO_ISOLATION, "Operation refused, unit may not be isolated."); + return sd_bus_error_set(reterr_error, BUS_ERROR_NO_ISOLATION, "Operation refused, unit may not be isolated."); if (mode == JOB_TRIGGERING && type != JOB_STOP) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "--job-mode=triggering is only valid for stop."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "--job-mode=triggering is only valid for stop."); if (mode == JOB_RESTART_DEPENDENCIES && type != JOB_START) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "--job-mode=restart-dependencies is only valid for start."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "--job-mode=restart-dependencies is only valid for start."); tr = transaction_new(mode == JOB_REPLACE_IRREVERSIBLY, ++m->last_transaction_id); if (!tr) @@ -2176,7 +2176,7 @@ int manager_add_job_full( (mode == JOB_IGNORE_DEPENDENCIES ? TRANSACTION_IGNORE_ORDER : 0) | (mode == JOB_RESTART_DEPENDENCIES ? TRANSACTION_PROPAGATE_START_AS_RESTART : 0) | extra_flags, - error); + reterr_error); if (r < 0) return r; @@ -2192,7 +2192,7 @@ int manager_add_job_full( return r; } - r = transaction_activate(tr, m, mode, affected_jobs, error); + r = transaction_activate(tr, m, mode, affected_jobs, reterr_error); if (r < 0) return r; @@ -2212,10 +2212,10 @@ int manager_add_job( JobType type, Unit *unit, JobMode mode, - sd_bus_error *error, + sd_bus_error *reterr_error, Job **ret) { - return manager_add_job_full(m, type, unit, mode, 0, NULL, error, ret); + return manager_add_job_full(m, type, unit, mode, 0, NULL, reterr_error, ret); } int manager_add_job_by_name(Manager *m, JobType type, const char *name, JobMode mode, Set *affected_jobs, sd_bus_error *e, Job **ret) { diff --git a/src/core/manager.h b/src/core/manager.h index b8a5bb443b6..99b93ebc5a4 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -538,14 +538,14 @@ int manager_add_job_full( JobMode mode, TransactionAddFlags extra_flags, Set *affected_jobs, - sd_bus_error *error, + sd_bus_error *reterr_error, Job **ret); int manager_add_job( Manager *m, JobType type, Unit *unit, JobMode mode, - sd_bus_error *error, + sd_bus_error *reterr_error, Job **ret); int manager_add_job_by_name(Manager *m, JobType type, const char *name, JobMode mode, Set *affected_jobs, sd_bus_error *e, Job **ret); diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c index 7d1b2791a7c..7457b3d4563 100644 --- a/src/core/selinux-access.c +++ b/src/core/selinux-access.c @@ -142,7 +142,7 @@ _printf_(2, 3) static int log_callback(int type, const char *fmt, ...) { return 0; } -static int access_init(sd_bus_error *error) { +static int access_init(sd_bus_error *reterr_error) { int r; if (!mac_selinux_use()) @@ -163,7 +163,7 @@ static int access_init(sd_bus_error *error) { /* Return an access denied error based on the original errno, if we couldn't load the AVC but * enforcing mode was on, or we couldn't determine whether it is one. */ errno = -r; - return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Failed to open the SELinux AVC: %m"); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_ACCESS_DENIED, "Failed to open the SELinux AVC: %m"); } sym_selinux_set_callback(SELINUX_CB_AUDIT, (union selinux_callback) { .func_audit = audit_callback }); @@ -212,7 +212,7 @@ static int check_access( const char *tclass, const char *permission, struct audit_info *audit_info, - sd_bus_error *error) { + sd_bus_error *reterr_error) { bool enforce = mac_selinux_enforcing(); int r; @@ -229,7 +229,7 @@ static int check_access( errno = -(r = errno_or_else(EPERM)); if (enforce) - sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "SELinux policy denies access: %m"); + sd_bus_error_setf(reterr_error, SD_BUS_ERROR_ACCESS_DENIED, "SELinux policy denies access: %m"); } return log_selinux_enforcing_errno( @@ -256,7 +256,7 @@ int mac_selinux_access_check_bus_internal( const Unit *unit, const char *permission, const char *function, - sd_bus_error *error) { + sd_bus_error *reterr_error) { _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL; const char *tclass, *scon, *acon; @@ -270,7 +270,7 @@ int mac_selinux_access_check_bus_internal( assert(permission); assert(function); - r = access_init(error); + r = access_init(reterr_error); if (r <= 0) return r; @@ -309,9 +309,9 @@ int mac_selinux_access_check_bus_internal( return 0; if (r == -EOPNOTSUPP) - return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "We appear not to have any SELinux context: %m"); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_ACCESS_DENIED, "We appear not to have any SELinux context: %m"); - return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Failed to get current context: %m"); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_ACCESS_DENIED, "Failed to get current context: %m"); } (void) sd_bus_creds_get_cmdline(creds, &cmdline); @@ -324,7 +324,7 @@ int mac_selinux_access_check_bus_internal( .function = function, }; - return check_access(scon, acon, tclass, permission, &audit_info, error); + return check_access(scon, acon, tclass, permission, &audit_info, reterr_error); } int mac_selinux_access_check_varlink_internal( @@ -341,7 +341,7 @@ int mac_selinux_access_check_varlink_internal( assert(permission); assert(function); - r = access_init(/* error= */ NULL); + r = access_init(/* reterr_error= */ NULL); if (r <= 0) /* access_init() does log_selinux_enforcing_errno() */ return r; @@ -380,7 +380,7 @@ int mac_selinux_access_check_varlink_internal( .function = function, }; - return check_access(scon, acon, tclass, permission, &audit_info, /* error= */ NULL); + return check_access(scon, acon, tclass, permission, &audit_info, /* reterr_error= */ NULL); } #else /* HAVE_SELINUX */ @@ -390,7 +390,7 @@ int mac_selinux_access_check_bus_internal( const Unit *unit, const char *permission, const char *function, - sd_bus_error *error) { + sd_bus_error *reterr_error) { return 0; } diff --git a/src/core/selinux-access.h b/src/core/selinux-access.h index 1290c0874a4..ec268b08fd2 100644 --- a/src/core/selinux-access.h +++ b/src/core/selinux-access.h @@ -3,8 +3,17 @@ #include "core-forward.h" -int mac_selinux_access_check_bus_internal(sd_bus_message *message, const Unit *unit, const char *permission, const char *function, sd_bus_error *error); -int mac_selinux_access_check_varlink_internal(sd_varlink *link, const Unit *unit, const char *permission, const char *function); +int mac_selinux_access_check_bus_internal( + sd_bus_message *message, + const Unit *unit, + const char *permission, + const char *function, + sd_bus_error *reterr_error); +int mac_selinux_access_check_varlink_internal( + sd_varlink *link, + const Unit *unit, + const char *permission, + const char *function); #define mac_selinux_access_check(message, permission, error) \ mac_selinux_access_check_bus_internal((message), NULL, (permission), __func__, (error)) diff --git a/src/core/service.c b/src/core/service.c index 12f4733274c..3f555912ca0 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -5507,7 +5507,7 @@ static int service_live_mount( sd_bus_message *message, MountInNamespaceFlags flags, const MountOptions *options, - sd_bus_error *error) { + sd_bus_error *reterr_error) { Service *s = ASSERT_PTR(SERVICE(u)); _cleanup_(pidref_done) PidRef worker = PIDREF_NULL; @@ -5523,7 +5523,7 @@ static int service_live_mount( if (s->state != SERVICE_RUNNING || !pidref_is_set(&s->main_pid)) { log_unit_warning(u, "Service is not running, cannot live mount."); return sd_bus_error_setf( - error, + reterr_error, BUS_ERROR_UNIT_INACTIVE, "Live mounting '%s' on '%s' for unit '%s' cannot be scheduled: service not running", src, @@ -5534,7 +5534,7 @@ static int service_live_mount( if (mount_point_is_credentials(u->manager->prefix[EXEC_DIRECTORY_RUNTIME], dst)) { log_unit_warning(u, "Refusing to live mount over credential mount '%s'.", dst); return sd_bus_error_setf( - error, + reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Live mounting '%s' on '%s' for unit '%s' cannot be scheduled: cannot mount over credential mount", src, @@ -5545,7 +5545,7 @@ static int service_live_mount( if (path_startswith_strv(dst, s->exec_context.inaccessible_paths)) { log_unit_warning(u, "%s is not accessible to this unit, cannot live mount.", dst); return sd_bus_error_setf( - error, + reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Live mounting '%s' on '%s' for unit '%s' cannot be scheduled: destination is not accessible to this unit", src, @@ -5563,7 +5563,7 @@ static int service_live_mount( r = service_arm_timer(s, /* relative= */ true, s->timeout_start_usec); if (r < 0) { log_unit_error_errno(u, r, "Failed to install timer: %m"); - sd_bus_error_set_errnof(error, r, + sd_bus_error_set_errnof(reterr_error, r, "Live mounting '%s' on '%s' for unit '%s': failed to install timer: %m", src, dst, u->id); goto fail; @@ -5580,7 +5580,7 @@ static int service_live_mount( log_unit_error_errno(u, r, "Failed to fork process to mount '%s' on '%s' in unit's namespace: %m", src, dst); - sd_bus_error_set_errnof(error, r, + sd_bus_error_set_errnof(reterr_error, r, "Live mounting '%s' on '%s' for unit '%s': failed to fork off helper process into namespace: %m", src, dst, u->id); goto fail; @@ -5615,7 +5615,7 @@ static int service_live_mount( r = unit_watch_pidref(u, &worker, /* exclusive= */ true); if (r < 0) { log_unit_warning_errno(u, r, "Failed to watch live mount helper process: %m"); - sd_bus_error_set_errnof(error, r, + sd_bus_error_set_errnof(reterr_error, r, "Live mounting '%s' on '%s' for unit '%s': failed to watch live mount helper process: %m", src, dst, u->id); goto fail; @@ -5632,13 +5632,13 @@ fail: return r; } -static int service_can_live_mount(Unit *u, sd_bus_error *error) { +static int service_can_live_mount(Unit *u, sd_bus_error *reterr_error) { Service *s = ASSERT_PTR(SERVICE(u)); /* Ensure that the unit runs in a private mount namespace */ if (!exec_needs_mount_namespace(&s->exec_context, /* params= */ NULL, s->exec_runtime)) return sd_bus_error_setf( - error, + reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Unit '%s' not running in private mount namespace, cannot live mount.", u->id); diff --git a/src/core/unit.c b/src/core/unit.c index b840370e244..eee0c417d07 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2290,16 +2290,16 @@ static void retroactively_start_dependencies(Unit *u) { UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_START_REPLACE) /* Requires= + BindsTo= */ if (!unit_has_dependency(u, UNIT_ATOM_AFTER, other) && !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other))) - (void) manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, /* error = */ NULL, /* ret = */ NULL); + (void) manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, /* reterr_error = */ NULL, /* ret = */ NULL); UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_START_FAIL) /* Wants= */ if (!unit_has_dependency(u, UNIT_ATOM_AFTER, other) && !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other))) - (void) manager_add_job(u->manager, JOB_START, other, JOB_FAIL, /* error = */ NULL, /* ret = */ NULL); + (void) manager_add_job(u->manager, JOB_START, other, JOB_FAIL, /* reterr_error = */ NULL, /* ret = */ NULL); UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_STOP_ON_START) /* Conflicts= (and inverse) */ if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other))) - (void) manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, /* error = */ NULL, /* ret = */ NULL); + (void) manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, /* reterr_error = */ NULL, /* ret = */ NULL); } static void retroactively_stop_dependencies(Unit *u) { @@ -2311,7 +2311,7 @@ static void retroactively_stop_dependencies(Unit *u) { /* Pull down units which are bound to us recursively if enabled */ UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_STOP_ON_STOP) /* BoundBy= */ if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other))) - (void) manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, /* error = */ NULL, /* ret = */ NULL); + (void) manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, /* reterr_error = */ NULL, /* ret = */ NULL); } void unit_start_on_termination_deps(Unit *u, UnitDependencyAtom atom) { @@ -3533,7 +3533,7 @@ int unit_load_related_unit(Unit *u, const char *type, Unit **_found) { return r; } -static int signal_name_owner_changed_install_handler(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int signal_name_owner_changed_install_handler(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { Unit *u = ASSERT_PTR(userdata); const sd_bus_error *e; int r; @@ -3559,7 +3559,7 @@ static int signal_name_owner_changed_install_handler(sd_bus_message *message, vo return 0; } -static int signal_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int signal_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { const char *new_owner; Unit *u = ASSERT_PTR(userdata); int r; @@ -3578,7 +3578,7 @@ static int signal_name_owner_changed(sd_bus_message *message, void *userdata, sd return 0; } -static int get_name_owner_handler(sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int get_name_owner_handler(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) { const sd_bus_error *e; const char *new_owner; Unit *u = ASSERT_PTR(userdata); @@ -6096,7 +6096,7 @@ bool unit_needs_console(Unit *u) { return exec_context_may_touch_console(ec); } -int unit_pid_attachable(Unit *u, PidRef *pid, sd_bus_error *error) { +int unit_pid_attachable(Unit *u, PidRef *pid, sd_bus_error *reterr_error) { int r; assert(u); @@ -6106,20 +6106,20 @@ int unit_pid_attachable(Unit *u, PidRef *pid, sd_bus_error *error) { /* First, a simple range check */ if (!pidref_is_set(pid)) - return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Process identifier is not valid."); + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Process identifier is not valid."); /* Some extra safety check */ if (pid->pid == 1 || pidref_is_self(pid)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Process " PID_FMT " is a manager process, refusing.", pid->pid); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Process " PID_FMT " is a manager process, refusing.", pid->pid); /* Don't even begin to bother with kernel threads */ r = pidref_is_kernel_thread(pid); if (r == -ESRCH) - return sd_bus_error_setf(error, SD_BUS_ERROR_UNIX_PROCESS_ID_UNKNOWN, "Process with ID " PID_FMT " does not exist.", pid->pid); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_UNIX_PROCESS_ID_UNKNOWN, "Process with ID " PID_FMT " does not exist.", pid->pid); if (r < 0) - return sd_bus_error_set_errnof(error, r, "Failed to determine whether process " PID_FMT " is a kernel thread: %m", pid->pid); + return sd_bus_error_set_errnof(reterr_error, r, "Failed to determine whether process " PID_FMT " is a kernel thread: %m", pid->pid); if (r > 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Process " PID_FMT " is a kernel thread, refusing.", pid->pid); + return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Process " PID_FMT " is a kernel thread, refusing.", pid->pid); return 0; } @@ -6531,19 +6531,19 @@ Condition *unit_find_failed_condition(Unit *u) { return failed_trigger && !has_succeeded_trigger ? failed_trigger : NULL; } -int unit_can_live_mount(Unit *u, sd_bus_error *error) { +int unit_can_live_mount(Unit *u, sd_bus_error *reterr_error) { assert(u); if (!UNIT_VTABLE(u)->live_mount) return sd_bus_error_setf( - error, + reterr_error, SD_BUS_ERROR_NOT_SUPPORTED, "Live mounting not supported by unit type '%s'", unit_type_to_string(u->type)); if (u->load_state != UNIT_LOADED) return sd_bus_error_setf( - error, + reterr_error, BUS_ERROR_NO_SUCH_UNIT, "Unit '%s' not loaded, cannot live mount", u->id); @@ -6551,7 +6551,7 @@ int unit_can_live_mount(Unit *u, sd_bus_error *error) { if (!UNIT_VTABLE(u)->can_live_mount) return 0; - return UNIT_VTABLE(u)->can_live_mount(u, error); + return UNIT_VTABLE(u)->can_live_mount(u, reterr_error); } int unit_live_mount( @@ -6561,7 +6561,7 @@ int unit_live_mount( sd_bus_message *message, MountInNamespaceFlags flags, const MountOptions *options, - sd_bus_error *error) { + sd_bus_error *reterr_error) { assert(u); assert(UNIT_VTABLE(u)->live_mount); @@ -6569,7 +6569,7 @@ int unit_live_mount( if (!UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u))) { log_unit_debug(u, "Unit not active, cannot perform live mount."); return sd_bus_error_setf( - error, + reterr_error, BUS_ERROR_UNIT_INACTIVE, "Live mounting '%s' on '%s' for unit '%s' cannot be scheduled: unit not active", src, @@ -6580,7 +6580,7 @@ int unit_live_mount( if (unit_active_state(u) == UNIT_REFRESHING) { log_unit_debug(u, "Unit already live mounting, refusing further requests."); return sd_bus_error_setf( - error, + reterr_error, BUS_ERROR_UNIT_BUSY, "Live mounting '%s' on '%s' for unit '%s' cannot be scheduled: another live mount in progress", src, @@ -6591,7 +6591,7 @@ int unit_live_mount( if (u->job) { log_unit_debug(u, "Unit already has a job in progress, cannot live mount"); return sd_bus_error_setf( - error, + reterr_error, BUS_ERROR_UNIT_BUSY, "Live mounting '%s' on '%s' for unit '%s' cannot be scheduled: another operation in progress", src, @@ -6599,7 +6599,7 @@ int unit_live_mount( u->id); } - return UNIT_VTABLE(u)->live_mount(u, src, dst, message, flags, options, error); + return UNIT_VTABLE(u)->live_mount(u, src, dst, message, flags, options, reterr_error); } static const char* const collect_mode_table[_COLLECT_MODE_MAX] = { diff --git a/src/core/unit.h b/src/core/unit.h index 664f4b18ae4..72f30227611 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -600,8 +600,8 @@ typedef struct UnitVTable { bool (*can_reload)(Unit *u); /* Add a bind/image mount into the unit namespace while it is running. */ - int (*live_mount)(Unit *u, const char *src, const char *dst, sd_bus_message *message, MountInNamespaceFlags flags, const MountOptions *options, sd_bus_error *error); - int (*can_live_mount)(Unit *u, sd_bus_error *error); + int (*live_mount)(Unit *u, const char *src, const char *dst, sd_bus_message *message, MountInNamespaceFlags flags, const MountOptions *options, sd_bus_error *reterr_error); + int (*can_live_mount)(Unit *u, sd_bus_error *reterr_error); /* Serialize state and file descriptors that should be carried over into the new * instance after reexecution. */ @@ -661,7 +661,7 @@ typedef struct UnitVTable { void (*bus_name_owner_change)(Unit *u, const char *new_owner); /* Called for each property that is being set */ - int (*bus_set_property)(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); + int (*bus_set_property)(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *reterr_error); /* Called after at least one property got changed to apply the necessary change */ int (*bus_commit_properties)(Unit *u); @@ -1021,7 +1021,7 @@ int unit_warn_leftover_processes(Unit *u, bool start); bool unit_needs_console(Unit *u); -int unit_pid_attachable(Unit *unit, PidRef *pid, sd_bus_error *error); +int unit_pid_attachable(Unit *unit, PidRef *pid, sd_bus_error *reterr_error); static inline bool unit_has_job_type(Unit *u, JobType type) { return u && u->job && u->job->type == type; @@ -1065,8 +1065,15 @@ void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret_ne void unit_set_freezer_state(Unit *u, FreezerState state); void unit_freezer_complete(Unit *u, FreezerState kernel_state); -int unit_can_live_mount(Unit *u, sd_bus_error *error); -int unit_live_mount(Unit *u, const char *src, const char *dst, sd_bus_message *message, MountInNamespaceFlags flags, const MountOptions *options, sd_bus_error *error); +int unit_can_live_mount(Unit *u, sd_bus_error *reterr_error); +int unit_live_mount( + Unit *u, + const char *src, + const char *dst, + sd_bus_message *message, + MountInNamespaceFlags flags, + const MountOptions *options, + sd_bus_error *reterr_error); Condition *unit_find_failed_condition(Unit *u); diff --git a/src/core/varlink-unit.c b/src/core/varlink-unit.c index 634d2fadbfb..6de47cfeb77 100644 --- a/src/core/varlink-unit.c +++ b/src/core/varlink-unit.c @@ -297,7 +297,7 @@ static int unit_runtime_build_json(sd_json_variant **ret, const char *name, void SD_JSON_BUILD_PAIR_BOOLEAN("CanIsolate", unit_can_isolate_refuse_manual(u)), JSON_BUILD_PAIR_CALLBACK_NON_NULL("CanClean", can_clean_build_json, u), SD_JSON_BUILD_PAIR_BOOLEAN("CanFreeze", unit_can_freeze(u)), - SD_JSON_BUILD_PAIR_BOOLEAN("CanLiveMount", unit_can_live_mount(u, /* error= */ NULL) >= 0), + SD_JSON_BUILD_PAIR_BOOLEAN("CanLiveMount", unit_can_live_mount(u, /* reterr_error= */ NULL) >= 0), JSON_BUILD_PAIR_UNSIGNED_NON_ZERO("JobId", u->job ? u->job->id : 0), SD_JSON_BUILD_PAIR_BOOLEAN("NeedDaemonReload", unit_need_daemon_reload(u)), SD_JSON_BUILD_PAIR_BOOLEAN("ConditionResult", u->condition_result), -- 2.47.3