summaryrefslogtreecommitdiff
path: root/src/shared/bus-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-11-04 10:37:11 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-11-04 11:00:15 +0100
commit237fbb67194bee720d95cb0ab20821e1822e8ce4 (patch)
treeceec16894d56087dbbd93552466f09d8d0d2e475 /src/shared/bus-util.c
parentdb2aef5a1d95cea835d2a76db6da266cc4af61d6 (diff)
downloadsystemd-237fbb67194bee720d95cb0ab20821e1822e8ce4.tar.gz
shared/bus-util: make bus_log_*_error() functions functions
They were defined as macros, but they are a bit too complicated for this, so it's getting unwieldy. We can make them functions without any loss.
Diffstat (limited to 'src/shared/bus-util.c')
-rw-r--r--src/shared/bus-util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 942a59be88..75e89ab5dc 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -34,6 +34,19 @@ static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_
return 1;
}
+int bus_log_address_error(int r) {
+ 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");
+}
+
+int bus_log_connect_error(int r) {
+ return log_error_errno(r,
+ r == -ENOMEDIUM ? "Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)" :
+ ERRNO_IS_PRIVILEGE(r) ? "Failed to connect to bus: Operation not permitted (consider using --machine=<user>@.host --user to connect to bus of other user)" :
+ "Failed to connect to bus: %m");
+}
+
int bus_async_unregister_and_exit(sd_event *e, sd_bus *bus, const char *name) {
const char *match;
const char *unique;