summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-error.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-19 01:19:02 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-20 19:36:14 +0100
commit80c1974018fef49d74736c6893674e8e6eddd1d4 (patch)
tree5c44e3625f3d4a6e35048c4ae6640f6169db1da7 /src/libsystemd-bus/bus-error.c
parent725d7e6cebcafef3bd4adbf76c8fa73a9b18972e (diff)
bus: sd_bus_error_setxyz calls should always return the error as errno style negative int
Diffstat (limited to 'src/libsystemd-bus/bus-error.c')
-rw-r--r--src/libsystemd-bus/bus-error.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libsystemd-bus/bus-error.c b/src/libsystemd-bus/bus-error.c
index 1a467cfdb0..652d8e2e70 100644
--- a/src/libsystemd-bus/bus-error.c
+++ b/src/libsystemd-bus/bus-error.c
@@ -74,7 +74,7 @@ _public_ int sd_bus_error_set(sd_bus_error *e, const char *name, const char *mes
e->message = m;
e->need_free = true;
- return 0;
+ return sd_bus_error_get_errno(e);
}
int bus_error_setfv(sd_bus_error *e, const char *name, const char *format, va_list ap) {
@@ -103,7 +103,7 @@ int bus_error_setfv(sd_bus_error *e, const char *name, const char *format, va_li
e->message = m;
e->need_free = true;
- return 0;
+ return sd_bus_error_get_errno(e);
}
_public_ int sd_bus_error_setf(sd_bus_error *e, const char *name, const char *format, ...) {
@@ -147,7 +147,7 @@ _public_ int sd_bus_error_copy(sd_bus_error *dest, const sd_bus_error *e) {
dest->name = x;
dest->message = y;
dest->need_free = true;
- return 0;
+ return sd_bus_error_get_errno(e);
}
_public_ int sd_bus_error_set_const(sd_bus_error *e, const char *name, const char *message) {
@@ -158,7 +158,7 @@ _public_ int sd_bus_error_set_const(sd_bus_error *e, const char *name, const cha
assert_return(name, -EINVAL);
*e = SD_BUS_ERROR_MAKE(name, message);
- return 0;
+ return sd_bus_error_get_errno(e);
}
_public_ int sd_bus_error_is_set(const sd_bus_error *e) {
@@ -396,7 +396,7 @@ int bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_lis
error = -error;
if (!e)
- return 0;
+ return -error;
assert_return(!bus_error_is_dirty(e), -EINVAL);
@@ -428,8 +428,11 @@ fallback:
_public_ int sd_bus_error_set_errnof(sd_bus_error *e, int error, const char *format, ...) {
int r;
+ if (error < 0)
+ error = -error;
+
if (!e)
- return 0;
+ return -error;
assert_return(!bus_error_is_dirty(e), -EINVAL);