diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-04-07 15:59:27 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-04-07 16:04:52 +0200 |
commit | 1b09b81cf4296487094f86e75c4ab14bf5701e59 (patch) | |
tree | 14eebe23c63a3254c708fb33c56e890abcc4a3cc /src/core/dbus-service.c | |
parent | 7756528e9bb79394c87d9161761e67e16eb2c47b (diff) | |
download | systemd-1b09b81cf4296487094f86e75c4ab14bf5701e59.tar.gz |
tree-wide: sd_bus_error_setf → set_bus_error_set
strdup() is more efficient than asprintf().
Diffstat (limited to 'src/core/dbus-service.c')
-rw-r--r-- | src/core/dbus-service.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c index 73906ebab7..4dea8d5aec 100644 --- a/src/core/dbus-service.c +++ b/src/core/dbus-service.c @@ -109,7 +109,7 @@ static int bus_service_method_mount(sd_bus_message *message, void *userdata, sd_ assert(u); if (!MANAGER_IS_SYSTEM(u->manager)) - return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Adding bind mounts at runtime is only supported for system managers."); + return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "Adding bind mounts at runtime is only supported for system managers."); r = mac_selinux_unit_access_check(u, message, "start", error); if (r < 0) @@ -120,12 +120,12 @@ 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_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Source path must be absolute and normalized."); + return sd_bus_error_set(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_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Destination path must be absolute and normalized."); + return sd_bus_error_set(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, ""); @@ -147,23 +147,23 @@ static int bus_service_method_mount(sd_bus_message *message, void *userdata, sd_ return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ if (u->type != UNIT_SERVICE) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unit is not of type .service"); + return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Unit is not of type .service"); /* If it would be dropped at startup time, return an error. The context should always be available, but * there's an assert in exec_needs_mount_namespace, so double-check just in case. */ c = unit_get_exec_context(u); if (!c) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Cannot access unit execution context"); + return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Cannot access unit execution context"); if (path_startswith_strv(dest, c->inaccessible_paths)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s is not accessible to this unit", dest); /* Ensure that the unit was started in a private mount namespace */ if (!exec_needs_mount_namespace(c, NULL, unit_get_exec_runtime(u))) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unit not running in private mount namespace, cannot activate bind mount"); + return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Unit not running in private mount namespace, cannot activate bind mount"); unit_pid = unit_main_pid(u); if (unit_pid == 0 || !UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u))) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unit is not running"); + return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Unit is not running"); propagate_directory = strjoina("/run/systemd/propagate/", u->id); if (is_image) |