summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-06-16 15:29:16 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-06-16 09:29:16 -0400
commitcf647b69baee4c478d3909c327e3d917e1563f44 (patch)
treeccc736b268a08a6f11d63d6e7fd2f1d210d054d3 /src/libsystemd
parentdce588ec9d440d952af319c8afb698d6a1576875 (diff)
systemctl: make sure we terminate the bus connection first, and then close the pager (#3550)
If "systemctl -H" is used, let's make sure we first terminate the bus connection, and only then close the pager. If done in this order ssh will get an EOF on stdin (as we speak D-Bus through ssh's stdin/stdout), and then terminate. This makes sure the standard error we were invoked on is released by ssh, and only that makes sure we don't deadlock on the pager which waits for all clients closing its input pipe. (Similar fixes for the various other xyzctl tools that support both pagers and -H) Fixes: #3543
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/busctl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index bfe967bfb0..eb042e9c81 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -1987,7 +1987,7 @@ static int busctl_main(sd_bus *bus, int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
- _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+ sd_bus *bus = NULL;
int r;
log_parse_environment();
@@ -2078,6 +2078,7 @@ int main(int argc, char *argv[]) {
r = busctl_main(bus, argc, argv);
finish:
+ sd_bus_flush_close_unref(bus);
pager_close();
strv_free(arg_matches);