summaryrefslogtreecommitdiff
path: root/src/shared/dbus-common.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-05 00:34:48 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-05 00:36:08 +0200
commiteecd1362f7f4de432483b5d77c56726c3621a83a (patch)
treee8f1f3639121d317660cc6cc0d5ffe8f8731a39f /src/shared/dbus-common.c
parenta26336da875a6657d404d1e44b86ae067c34b110 (diff)
logind: implement delay inhibitor locks in addition to block inhibitor locks
This is useful to allow applications to synchronously save data before the system is suspended or shut down.
Diffstat (limited to 'src/shared/dbus-common.c')
-rw-r--r--src/shared/dbus-common.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/shared/dbus-common.c b/src/shared/dbus-common.c
index e161273cd8..ddb50b1eca 100644
--- a/src/shared/dbus-common.c
+++ b/src/shared/dbus-common.c
@@ -245,7 +245,8 @@ int bus_connect_system_polkit(DBusConnection **_bus, DBusError *error) {
}
const char *bus_error_message(const DBusError *error) {
- assert(error);
+ if (!error)
+ return NULL;
/* Sometimes the D-Bus server is a little bit too verbose with
* its error messages, so let's override them here */
@@ -255,6 +256,14 @@ const char *bus_error_message(const DBusError *error) {
return error->message;
}
+const char *bus_error_message_or_strerror(const DBusError *error, int err) {
+
+ if (error && dbus_error_is_set(error))
+ return bus_error_message(error);
+
+ return strerror(err);
+}
+
DBusHandlerResult bus_default_message_handler(
DBusConnection *c,
DBusMessage *message,