]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_monitor_json: Properly check "return" type
authorJiri Denemark <jdenemar@redhat.com>
Wed, 28 Mar 2018 10:45:21 +0000 (12:45 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 3 Apr 2018 12:13:07 +0000 (14:13 +0200)
commit452c2cc7e741ce6b4e3e0fd9833c64a4428e5669
tree76c566d456330b1e7b304e793f39349f91172494
parent56b7d94f111ac3faf7a9119918dae8ba970671f7
qemu_monitor_json: Properly check "return" type

My commit 2e0d6cdec41 claimed qemuMonitorJSONCheckError guarantees
"return" object exists in the JSON reply. But it only makes sure the key
is there, while the type of the value is not checked. A lot of callers
do not care since they only want to see whether their QMP command failed
or not, but any caller which needs to read some data from the reply
wants to make sure the correct data type was returned.

This patch adds a new API called qemuMonitorJSONCheckReply which calls
qemuMonitorJSONCheckError and checks "return" contains a value of the
specified type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_monitor_json.c