From 16aefbabe302ffbc0df53faebf04deddc5dfbf6b Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Wed, 6 Dec 2017 17:06:15 +0100 Subject: [PATCH] Distinguish DBus connection and name acquired error Distinguish between a failure to connect to DBus and a failure to connect to the actual FDN DBus path. This is possible, because `on_name_acquired` gets its DBus connection passed as a parameter. If this parameter is NULL, there is no connection established and the DBus name is not lost, because another notification daemon is running. --- src/dbus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dbus.c b/src/dbus.c index bf9a815..8990e38 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -418,7 +418,11 @@ static void on_name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data) { - fprintf(stderr, "Name Lost. Is Another notification daemon running?\n"); + if (connection) + fprintf(stderr, "Cannot acquire 'org.freedesktop.Notifications'." + "Is Another notification daemon running?\n"); + else + fprintf(stderr, "Cannot connect to DBus.\n"); exit(1); }