summaryrefslogtreecommitdiff
path: root/src/analyze
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-12-18 19:35:03 +0100
committerLennart Poettering <lennart@poettering.net>2017-12-18 19:35:03 +0100
commitbf0e0a4df2d41a5631811f7db6b6c1c866c3ed80 (patch)
tree2b33996196cbcc8b225e1c5f19f3a8c872f3b101 /src/analyze
parentbd8fdbcfc559e0691cca7dfba1b8e140dd163a96 (diff)
downloadsystemd-bf0e0a4df2d41a5631811f7db6b6c1c866c3ed80.tar.gz
analyze: use normal bus connection for "plot" verb (#7685)
We need to connect to hostnamed, so a private bus connection is no good. It'd be simpler to use the normal bus connection unconditionally, but that'd mean that e.g. systemd-analyze set-log-level might not work in emergency mode. So let's keep trying to use the private connection except for "plot". Fixes #7667.
Diffstat (limited to 'src/analyze')
-rw-r--r--src/analyze/analyze.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index d45c1dc496..7f35b04c31 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -130,6 +130,13 @@ struct host_info {
char *architecture;
};
+static int acquire_bus(bool need_full_bus, sd_bus **bus) {
+ if (need_full_bus)
+ return bus_connect_transport(arg_transport, arg_host, arg_user, bus);
+ else
+ return bus_connect_transport_systemd(arg_transport, arg_host, arg_user, bus);
+}
+
static int bus_get_uint64_property(sd_bus *bus, const char *path, const char *interface, const char *property, uint64_t *val) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
int r;
@@ -1688,7 +1695,7 @@ int main(int argc, char *argv[]) {
else {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
- r = bus_connect_transport_systemd(arg_transport, arg_host, arg_user, &bus);
+ r = acquire_bus(streq_ptr(argv[optind], "plot"), &bus);
if (r < 0) {
log_error_errno(r, "Failed to create bus connection: %m");
goto finish;