chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
core: initialize variable
[elogind.git]
/
src
/
core
/
dbus-job.c
diff --git
a/src/core/dbus-job.c
b/src/core/dbus-job.c
index bdb9096e42877023ced3a597e137943fd1100583..8c12b52b648a73749c93c7c5f878520afe4bdd27 100644
(file)
--- a/
src/core/dbus-job.c
+++ b/
src/core/dbus-job.c
@@
-35,8
+35,8
@@
static int property_get_unit(
const char *interface,
const char *property,
sd_bus_message *reply,
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;
_cleanup_free_ char *p = NULL;
Job *j = userdata;
@@
-52,14
+52,18
@@
static int property_get_unit(
return sd_bus_message_append(reply, "(so)", j->unit->id, p);
}
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;
Job *j = userdata;
+ int r;
assert(bus);
assert(message);
assert(j);
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);
job_finish_and_invalidate(j, JOB_CANCELED, true);
return sd_bus_reply_method_return(message, NULL);
@@
-80,7
+84,7
@@
static int foreach_client(Job *j, int (*send_message)(sd_bus *bus, const char *n
Iterator i;
sd_bus *b;
unsigned n, m;
Iterator i;
sd_bus *b;
unsigned n, m;
- int r;
+ int r
, ret
;
assert(j);
assert(send_message);
assert(j);
assert(send_message);
@@
-101,17
+105,22
@@
static int foreach_client(Job *j, int (*send_message)(sd_bus *bus, const char *n
if (one_destination)
return send_message(one_destination->bus, isempty(one_destination->name) ? NULL : one_destination->name, j);
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)
/* Send to everybody */
SET_FOREACH(b, j->manager->private_buses, i) {
r = send_message(b, NULL, j);
if (r < 0)
- ret
urn
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) {
}
static int send_new_signal(sd_bus *bus, const char *destination, Job *j) {
@@
-167,7
+176,7
@@
void bus_job_send_change_signal(Job *j) {
r = foreach_client(j, j->sent_dbus_new_signal ? send_changed_signal : send_new_signal);
if (r < 0)
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;
}
j->sent_dbus_new_signal = true;
}
@@
-211,6
+220,5
@@
void bus_job_send_removed_signal(Job *j) {
r = foreach_client(j, send_removed_signal);
if (r < 0)
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));
}
}