mirror of
https://github.com/systemd/systemd.git
synced 2025-01-26 14:04:03 +03:00
varlink: didn't generate a varlink error reply if a failed method call handler already did
It might happen that a method call handler already generated an error reply and then still propagated the error back to the varlink logic. Let's not try to generate a 2nd reply from that error code then, but simply proceed without. This simplifies handling of errors in method call handlers, because they can uniformly return errno-style error codes, and only if they want return a full Varlink errror.
This commit is contained in:
parent
c270fc448e
commit
041a66b843
@ -1330,7 +1330,9 @@ static int varlink_dispatch_method(Varlink *v) {
|
||||
log_debug_errno(r, "Callback for %s returned error: %m", method);
|
||||
|
||||
/* We got an error back from the callback. Propagate it to the client if the method call remains unanswered. */
|
||||
if (!FLAGS_SET(flags, VARLINK_METHOD_ONEWAY)) {
|
||||
if (v->state == VARLINK_PROCESSED_METHOD)
|
||||
r = 0; /* already processed */
|
||||
else if (!FLAGS_SET(flags, VARLINK_METHOD_ONEWAY)) {
|
||||
r = varlink_error_errno(v, r);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
Loading…
x
Reference in New Issue
Block a user