varlink: introduce varlink_call_and_log() which calls and then logs an error
As it turns out we do this in a similar way at various times (and sometimes incorrectly), hence add a common implementation to share the code and fix the incorrect behaviour.
This commit is contained in:
@@ -104,9 +104,9 @@ static int check_netns_match(void) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to connect to network service /run/systemd/netif/io.systemd.Network: %m");
|
||||
|
||||
r = varlink_call(vl, "io.systemd.Network.GetNamespaceId", /* parameters= */ NULL, &reply, /* ret_error_id= */ NULL);
|
||||
r = varlink_call_and_log(vl, "io.systemd.Network.GetNamespaceId", /* parameters= */ NULL, &reply);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to issue GetNamespaceId() varlink call: %m");
|
||||
return r;
|
||||
|
||||
static const JsonDispatch dispatch_table[] = {
|
||||
{ "NamespaceId", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, 0, JSON_MANDATORY },
|
||||
|
||||
Reference in New Issue
Block a user