chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dbus: make sure to flush bus connection before disconnecting, so that no messages...
[elogind.git]
/
src
/
systemctl.c
diff --git
a/src/systemctl.c
b/src/systemctl.c
index a85257ff6e0e35541c4c9c880f0768e2b71b6003..ecf3e013f2add664fcb4848d6a8904a8ee28a785 100644
(file)
--- a/
src/systemctl.c
+++ b/
src/systemctl.c
@@
-1081,7
+1081,7
@@
static int wait_for_jobs(DBusConnection *bus, Set *s) {
;
if (!arg_quiet && d.failed)
;
if (!arg_quiet && d.failed)
- log_error("Job failed, see logs for details.");
+ log_error("Job failed, see
system
logs for details.");
r = d.failed ? -EIO : 0;
r = d.failed ? -EIO : 0;
@@
-1134,7
+1134,7
@@
static int start_unit_one(
if (arg_action != ACTION_SYSTEMCTL && error_is_no_service(error)) {
/* There's always a fallback possible for
* legacy actions. */
if (arg_action != ACTION_SYSTEMCTL && error_is_no_service(error)) {
/* There's always a fallback possible for
* legacy actions. */
- r =
0
;
+ r =
-EADDRNOTAVAIL
;
goto finish;
}
goto finish;
}
@@
-1171,11
+1171,7
@@
static int start_unit_one(
}
}
}
}
- r = 1;
-
- /* Returns 1 if we managed to issue the request, and 0 if we
- * failed due to systemd not being around. This is then used
- * as indication to try a fallback mechanism. */
+ r = 0;
finish:
if (m)
finish:
if (m)
@@
-1281,12
+1277,7
@@
static int start_unit(DBusConnection *bus, char **args, unsigned n) {
} else {
for (i = 1; i < n; i++)
if ((r = start_unit_one(bus, method, args[i], mode, &error, s)) != 0) {
} else {
for (i = 1; i < n; i++)
if ((r = start_unit_one(bus, method, args[i], mode, &error, s)) != 0) {
-
- if (r > 0)
- ret = r;
- else
- ret = translate_bus_error_to_exit_status(r, &error);
-
+ ret = translate_bus_error_to_exit_status(r, &error);
dbus_error_free(&error);
}
}
dbus_error_free(&error);
}
}
@@
-2937,7
+2928,7
@@
static int daemon_reload(DBusConnection *bus, char **args, unsigned n) {
if (arg_action != ACTION_SYSTEMCTL && error_is_no_service(&error)) {
/* There's always a fallback possible for
* legacy actions. */
if (arg_action != ACTION_SYSTEMCTL && error_is_no_service(&error)) {
/* There's always a fallback possible for
* legacy actions. */
- r =
0
;
+ r =
-EADDRNOTAVAIL
;
goto finish;
}
goto finish;
}
@@
-2946,7
+2937,7
@@
static int daemon_reload(DBusConnection *bus, char **args, unsigned n) {
goto finish;
}
goto finish;
}
- r =
1
;
+ r =
0
;
finish:
if (m)
finish:
if (m)
@@
-4614,7
+4605,7
@@
static int talk_upstart(void) {
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
if (error_is_no_service(&error)) {
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
if (error_is_no_service(&error)) {
- r =
0
;
+ r =
-EADDRNOTAVAIL
;
goto finish;
}
goto finish;
}
@@
-4623,7
+4614,7
@@
static int talk_upstart(void) {
goto finish;
}
goto finish;
}
- r =
1
;
+ r =
0
;
finish:
if (m)
finish:
if (m)
@@
-4633,6
+4624,7
@@
finish:
dbus_message_unref(reply);
if (bus) {
dbus_message_unref(reply);
if (bus) {
+ dbus_connection_flush(bus);
dbus_connection_close(bus);
dbus_connection_unref(bus);
}
dbus_connection_close(bus);
dbus_connection_unref(bus);
}
@@
-4867,7
+4859,7
@@
static int start_with_fallback(DBusConnection *bus) {
if (bus) {
/* First, try systemd via D-Bus. */
if (bus) {
/* First, try systemd via D-Bus. */
- if (start_unit(bus, NULL, 0) > 0)
+ if (start_unit(bus, NULL, 0) >
=
0)
goto done;
}
goto done;
}
@@
-5048,6
+5040,7
@@
int main(int argc, char*argv[]) {
finish:
if (bus) {
finish:
if (bus) {
+ dbus_connection_flush(bus);
dbus_connection_close(bus);
dbus_connection_unref(bus);
}
dbus_connection_close(bus);
dbus_connection_unref(bus);
}