diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-02-13 15:38:38 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-02-13 15:49:51 +0100 |
commit | 5f6cb091278906423f8b7e70c40131db7269916a (patch) | |
tree | 9c482e4cc78b3592b12fde4cbfff66be68ac9ff9 /src/bus-proxyd/synthesize.c | |
parent | 1433efd219a6df414a1821b3d3d70d86201ed3e4 (diff) |
bus-proxy: whenever we cannot forward a message, report this back to caller, but don't exit
Errors like EPERM from the kernel should certainly not be reason to
exit. Let's try to be defensive here, and try to continue on most send
errors, but possibly tell the sender about it.
Diffstat (limited to 'src/bus-proxyd/synthesize.c')
-rw-r--r-- | src/bus-proxyd/synthesize.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/bus-proxyd/synthesize.c b/src/bus-proxyd/synthesize.c index 36ffe2930e..e1b0fd3535 100644 --- a/src/bus-proxyd/synthesize.c +++ b/src/bus-proxyd/synthesize.c @@ -83,7 +83,6 @@ int synthetic_reply_method_errorf(sd_bus_message *call, const char *name, const } int synthetic_reply_method_errno(sd_bus_message *call, int error, const sd_bus_error *p) { - _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL; assert(call); @@ -99,6 +98,22 @@ int synthetic_reply_method_errno(sd_bus_message *call, int error, const sd_bus_e return synthetic_reply_method_error(call, &berror); } +int synthetic_reply_method_errnof(sd_bus_message *call, int error, const char *format, ...) { + _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL; + va_list ap; + + assert(call); + + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) + return 0; + + va_start(ap, format); + sd_bus_error_set_errnofv(&berror, error, format, ap); + va_end(ap); + + return synthetic_reply_method_error(call, &berror); +} + int synthetic_reply_method_return(sd_bus_message *call, const char *types, ...) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL; int r; |