summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-convenience.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-22 04:01:46 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-22 04:23:22 +0100
commit780896a4f1ec7e36c8f72c866ba9693d790f9741 (patch)
tree7aa9cf31a9ce94c729758b555433283056df3f39 /src/libsystemd-bus/bus-convenience.c
parent6414b7c981378a6eef480f6806d7cbfc98ca22a1 (diff)
bus: rework sd_bus_error APIs
All calls that set a sd_bus_error structure will now return the same error converted to a negative errno. This may be used as syntactic sugar to return from a function and setting a bus_error structure in one go. Also, translate all Linux Exyz (EIO, EINVAL, EUCLEAN, EPIPE, ...) automatically into counterparts in the (new) "Posix.Error." namespace. If we fail to allocate memory for the components of a sd_bus_error automatically reset it to an OOM error which we always can write.
Diffstat (limited to 'src/libsystemd-bus/bus-convenience.c')
-rw-r--r--src/libsystemd-bus/bus-convenience.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/libsystemd-bus/bus-convenience.c b/src/libsystemd-bus/bus-convenience.c
index 6446874713..e765ddb21d 100644
--- a/src/libsystemd-bus/bus-convenience.c
+++ b/src/libsystemd-bus/bus-convenience.c
@@ -155,7 +155,6 @@ _public_ int sd_bus_reply_method_errorf(
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
va_list ap;
- int r;
assert_return(call, -EINVAL);
assert_return(call->sealed, -EPERM);
@@ -167,12 +166,9 @@ _public_ int sd_bus_reply_method_errorf(
return 0;
va_start(ap, format);
- r = bus_error_setfv(&error, name, format, ap);
+ bus_error_setfv(&error, name, format, ap);
va_end(ap);
- if (r < 0)
- return r;
-
return sd_bus_reply_method_error(call, &error);
}