const char *interface,
const char *property,
sd_bus_message *reply,
- sd_bus_error *error,
- void *userdata) {
+ void *userdata,
+ sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Job *j = userdata;
return sd_bus_message_append(reply, "(so)", j->unit->id, p);
}
-static int method_cancel(sd_bus *bus, sd_bus_message *message, void *userdata) {
+static int method_cancel(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Job *j = userdata;
+ int r;
assert(bus);
assert(message);
assert(j);
- SELINUX_UNIT_ACCESS_CHECK(j->unit, bus, message, "stop");
+ r = selinux_unit_access_check(j->unit, bus, message, "stop", error);
+ if (r < 0)
+ return r;
+
job_finish_and_invalidate(j, JOB_CANCELED, true);
return sd_bus_reply_method_return(message, NULL);
Iterator i;
sd_bus *b;
unsigned n, m;
- int r;
+ int r, ret;
assert(j);
assert(send_message);
if (one_destination)
return send_message(one_destination->bus, isempty(one_destination->name) ? NULL : one_destination->name, j);
+ ret = 0;
+
/* Send to everybody */
SET_FOREACH(b, j->manager->private_buses, i) {
r = send_message(b, NULL, j);
if (r < 0)
- return r;
+ ret = r;
}
- if (j->manager->api_bus)
- return send_message(j->manager->api_bus, NULL, j);
+ if (j->manager->api_bus) {
+ r = send_message(j->manager->api_bus, NULL, j);
+ if (r < 0)
+ ret = r;
+ }
- return 0;
+ return ret;
}
static int send_new_signal(sd_bus *bus, const char *destination, Job *j) {
r = foreach_client(j, j->sent_dbus_new_signal ? send_changed_signal : send_new_signal);
if (r < 0)
- log_warning("Failed to send job change signal for %u/%s: %s", j->id, j->unit->id, strerror(-r));
+ log_debug("Failed to send job change signal for %u: %s", j->id, strerror(-r));
j->sent_dbus_new_signal = true;
}
r = foreach_client(j, send_removed_signal);
if (r < 0)
- log_warning("Failed to send job removal signal for %u/%s: %s", j->id, j->unit->id, strerror(-r));
- return;
+ log_debug("Failed to send job remove signal for %u: %s", j->id, strerror(-r));
}