]> xenbits.xensource.com Git - libvirt.git/commit
cmdQemuMonitorCommandQMPWrap: Reset ignored errors from JSON parsing
authorPeter Krempa <pkrempa@redhat.com>
Tue, 1 Mar 2022 13:24:33 +0000 (14:24 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 25 Jul 2022 10:25:02 +0000 (12:25 +0200)
commit8e2a043c32c06c8d4978ca79bc9ffa9e39384649
treedf6edb93c30e16bf844a3af82d9657e566d3ef32
parent619d825a180c04723ffb238c2e77975163928b3b
cmdQemuMonitorCommandQMPWrap: Reset ignored errors from JSON parsing

'cmdQemuMonitorCommandQMPWrap' is checking whether the user provided
string is not valid JSON to avoid wrapping it. In cases where it's not
JSON we ignore the error and add the wrapper.

If the caller then reports a different non-libvirt error the error from
the JSON parsing would be printed as well. Reset errors we ignore:

 # virsh qemu-monitor-command cd --pass-fds a asdf
 error: Unable to parse FD number 'a'
 error: internal error: cannot parse json asdf: lexical error: invalid char in json text.
                                        asdf
                      (right here) ------^

In the above case 'asdf' is not valid JSON, but the code did wrap it
into '{"execute":"asdf"}', the only problem is the argument for
--pass-fds.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
tools/virsh-domain.c