mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-06 00:43:48 +00:00
qemuMonitorTestProcessCommandDefaultValidate: Clean up return value use
We no longer return the error via the monitor, so the function no longer returns '1'. Remove the mention from comment and fix callers to stop looking for the return value of '1'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7f350f5260
commit
7014d2ef14
@ -529,8 +529,7 @@ qemuMonitorTestHandlerDataFree(void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Returns -1 on error, 0 if validation was successful/not necessary, 1 if
|
/* Returns -1 on error, 0 if validation was successful/not necessary */
|
||||||
* the validation has failed, and the reply was properly constructed */
|
|
||||||
static int
|
static int
|
||||||
qemuMonitorTestProcessCommandDefaultValidate(qemuMonitorTestPtr test,
|
qemuMonitorTestProcessCommandDefaultValidate(qemuMonitorTestPtr test,
|
||||||
const char *cmdname,
|
const char *cmdname,
|
||||||
@ -585,7 +584,6 @@ qemuMonitorTestProcessCommandDefault(qemuMonitorTestPtr test,
|
|||||||
g_autoptr(virJSONValue) val = NULL;
|
g_autoptr(virJSONValue) val = NULL;
|
||||||
virJSONValuePtr cmdargs = NULL;
|
virJSONValuePtr cmdargs = NULL;
|
||||||
const char *cmdname;
|
const char *cmdname;
|
||||||
int rc;
|
|
||||||
|
|
||||||
if (!(val = virJSONValueFromString(cmdstr)))
|
if (!(val = virJSONValueFromString(cmdstr)))
|
||||||
return -1;
|
return -1;
|
||||||
@ -596,10 +594,8 @@ qemuMonitorTestProcessCommandDefault(qemuMonitorTestPtr test,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmdargs = virJSONValueObjectGet(val, "arguments");
|
cmdargs = virJSONValueObjectGet(val, "arguments");
|
||||||
if ((rc = qemuMonitorTestProcessCommandDefaultValidate(test, cmdname, cmdargs)) < 0)
|
if (qemuMonitorTestProcessCommandDefaultValidate(test, cmdname, cmdargs) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (rc == 1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (data->command_name && STRNEQ(data->command_name, cmdname)) {
|
if (data->command_name && STRNEQ(data->command_name, cmdname)) {
|
||||||
qemuMonitorTestErrorInvalidCommand(data->command_name, cmdname);
|
qemuMonitorTestErrorInvalidCommand(data->command_name, cmdname);
|
||||||
@ -641,7 +637,6 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test,
|
|||||||
virJSONValuePtr cmdargs;
|
virJSONValuePtr cmdargs;
|
||||||
const char *cmdname;
|
const char *cmdname;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int rc;
|
|
||||||
|
|
||||||
/* JSON strings will be reformatted to simplify checking */
|
/* JSON strings will be reformatted to simplify checking */
|
||||||
if (!(json = virJSONValueFromString(cmdstr)) ||
|
if (!(json = virJSONValueFromString(cmdstr)) ||
|
||||||
@ -653,12 +648,8 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test,
|
|||||||
/* in this case we do a best-effort schema check if we can find the command */
|
/* in this case we do a best-effort schema check if we can find the command */
|
||||||
if ((cmdname = virJSONValueObjectGetString(json, "execute"))) {
|
if ((cmdname = virJSONValueObjectGetString(json, "execute"))) {
|
||||||
cmdargs = virJSONValueObjectGet(json, "arguments");
|
cmdargs = virJSONValueObjectGet(json, "arguments");
|
||||||
|
if (qemuMonitorTestProcessCommandDefaultValidate(test, cmdname, cmdargs) < 0)
|
||||||
if ((rc = qemuMonitorTestProcessCommandDefaultValidate(test, cmdname, cmdargs)) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (rc == 1)
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STREQ(data->command_name, cmdstr)) {
|
if (STREQ(data->command_name, cmdstr)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user