summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-11-04 10:41:47 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-11-04 11:00:15 +0100
commitfb293b3c0f2f0e24d088a6ccaf3bd051301754af (patch)
tree32fcaff481a8cfa5d2351648edd58c1ab42cc249 /src/shared
parentshared/bus-util: make bus_log_*_error() functions functions (diff)
downloadsystemd-fb293b3c0f2f0e24d088a6ccaf3bd051301754af.tar.xz
systemd-fb293b3c0f2f0e24d088a6ccaf3bd051301754af.zip
busctl: do not print hint about -M if -M is already used
(Or when -H is used, since -H and -M are incompatible.)
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bus-util.c8
-rw-r--r--src/shared/bus-util.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 75e89ab5dc..8568135a4a 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -34,10 +34,12 @@ static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_
return 1;
}
-int bus_log_address_error(int r) {
+int bus_log_address_error(int r, BusTransport transport) {
+ bool hint = transport == BUS_TRANSPORT_LOCAL && r == -ENOMEDIUM;
+
return log_error_errno(r,
- r == -ENOMEDIUM ? "Failed to set bus address: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)" :
- "Failed to set bus address: %m");
+ hint ? "Failed to set bus address: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)" :
+ "Failed to set bus address: %m");
}
int bus_log_connect_error(int r) {
diff --git a/src/shared/bus-util.h b/src/shared/bus-util.h
index 3a65851fa5..4f0d186f95 100644
--- a/src/shared/bus-util.h
+++ b/src/shared/bus-util.h
@@ -39,7 +39,7 @@ int bus_connect_user_systemd(sd_bus **_bus);
int bus_connect_transport(BusTransport transport, const char *host, bool user, sd_bus **bus);
int bus_connect_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus);
-int bus_log_address_error(int r);
+int bus_log_address_error(int r, BusTransport transport);
int bus_log_connect_error(int r);
#define bus_log_parse_error(r) \