vmspawn-varlink: use error < 0 in async QMP completion callbacks
The QMP client always passes either 0 or a negative errno; the != 0 check flagged values that cannot occur. Switch to the < 0 idiom used elsewhere in the tree, and reorder on_qmp_simple_complete so the error path is the first branch (the more conventional shape for callbacks). Equivalent in behaviour. Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
@@ -51,10 +51,10 @@ static int on_qmp_simple_complete(
|
||||
|
||||
assert(client);
|
||||
|
||||
if (error == 0)
|
||||
(void) sd_varlink_reply(link, NULL);
|
||||
else
|
||||
if (error < 0)
|
||||
(void) qmp_error_to_varlink(link, error_desc, error);
|
||||
else
|
||||
(void) sd_varlink_reply(link, NULL);
|
||||
|
||||
sd_varlink_unref(link);
|
||||
return 0;
|
||||
@@ -118,7 +118,7 @@ static int on_qmp_describe_complete(
|
||||
|
||||
assert(client);
|
||||
|
||||
if (error != 0) {
|
||||
if (error < 0) {
|
||||
(void) qmp_error_to_varlink(link, error_desc, error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user