summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dbus-job.c4
-rw-r--r--src/core/dbus-job.h2
-rw-r--r--src/core/dbus-manager.c9
3 files changed, 6 insertions, 9 deletions
diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c
index 8e4ffc977d..542006257d 100644
--- a/src/core/dbus-job.c
+++ b/src/core/dbus-job.c
@@ -52,7 +52,7 @@ static int property_get_unit(
return sd_bus_message_append(reply, "(so)", j->unit->id, p);
}
-static int method_cancel(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int bus_job_method_cancel(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Job *j = userdata;
int r;
@@ -71,7 +71,7 @@ static int method_cancel(sd_bus *bus, sd_bus_message *message, void *userdata, s
const sd_bus_vtable bus_job_vtable[] = {
SD_BUS_VTABLE_START(0),
- SD_BUS_METHOD("Cancel", NULL, NULL, method_cancel, 0),
+ SD_BUS_METHOD("Cancel", NULL, NULL, bus_job_method_cancel, 0),
SD_BUS_PROPERTY("Id", "u", NULL, offsetof(Job, id), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("Unit", "(so)", property_get_unit, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("JobType", "s", property_get_type, offsetof(Job, type), SD_BUS_VTABLE_PROPERTY_CONST),
diff --git a/src/core/dbus-job.h b/src/core/dbus-job.h
index d1d0f6ddf0..6c2fc0789c 100644
--- a/src/core/dbus-job.h
+++ b/src/core/dbus-job.h
@@ -26,5 +26,7 @@
extern const sd_bus_vtable bus_job_vtable[];
+int bus_job_method_cancel(sd_bus *bus, sd_bus_message *message, void *job, sd_bus_error *error);
+
void bus_job_send_change_signal(Job *j);
void bus_job_send_removed_signal(Job *j);
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index ffef0c7d05..e4d6369c69 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -34,6 +34,7 @@
#include "architecture.h"
#include "env-util.h"
#include "dbus.h"
+#include "dbus-job.h"
#include "dbus-manager.h"
#include "dbus-unit.h"
#include "dbus-snapshot.h"
@@ -685,13 +686,7 @@ static int method_cancel_job(sd_bus *bus, sd_bus_message *message, void *userdat
if (!j)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id);
- r = selinux_unit_access_check(j->unit, message, "stop", error);
- if (r < 0)
- return r;
-
- job_finish_and_invalidate(j, JOB_CANCELED, true);
-
- return sd_bus_reply_method_return(message, NULL);
+ return bus_job_method_cancel(bus, message, j, error);
}
static int method_clear_jobs(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {