diff options
author | Simon Peeters <peeters.simon@gmail.com> | 2013-04-11 00:39:01 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-04-18 02:54:58 +0200 |
commit | 449101fce2757575c4813a9512890536365445f6 (patch) | |
tree | c0012796af10e30d588478b734e2982bb2a64f89 /src/shared | |
parent | 951657bd0a5bb32b5f56cc6b91ad2ea4094bdfaf (diff) |
Move bus_error to dbus-common and remove bus_error_message_or_strerror
bus_error and bus_error_message_or_strerror dit almost exactly the same,
so use only one of them and place it in dbus-common.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/dbus-common.c | 5 | ||||
-rw-r--r-- | src/shared/dbus-common.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/shared/dbus-common.c b/src/shared/dbus-common.c index 5afce7627a..b8c15cb9fc 100644 --- a/src/shared/dbus-common.c +++ b/src/shared/dbus-common.c @@ -258,12 +258,11 @@ const char *bus_error_message(const DBusError *error) { return error->message; } -const char *bus_error_message_or_strerror(const DBusError *error, int err) { - +const char *bus_error(const DBusError *error, int err) { if (error && dbus_error_is_set(error)) return bus_error_message(error); - return strerror(err); + return strerror(err < 0 ? -err : err); } DBusHandlerResult bus_default_message_handler( diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h index f7f614cdcd..16fc14b8e4 100644 --- a/src/shared/dbus-common.h +++ b/src/shared/dbus-common.h @@ -92,7 +92,7 @@ int bus_connect_system_ssh(const char *user, const char *host, DBusConnection ** int bus_connect_system_polkit(DBusConnection **_bus, DBusError *error); const char *bus_error_message(const DBusError *error); -const char *bus_error_message_or_strerror(const DBusError *error, int err); +const char *bus_error(const DBusError *e, int r); typedef int (*BusPropertyCallback)(DBusMessageIter *iter, const char *property, void *data); typedef int (*BusPropertySetCallback)(DBusMessageIter *iter, const char *property, void *data); |