Re: [PATCH 2/2] check whether qemuMonitorJSONHMP() failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 29, 2011 at 17:48:48 +0800, Wen Congyang wrote:
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index eed83f4..647e2bb 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -906,7 +906,14 @@ int qemuMonitorSetCapabilities(qemuMonitorPtr mon)
>  
>      if (mon->json) {
>          ret = qemuMonitorJSONSetCapabilities(mon);
> -        mon->json_hmp = qemuMonitorJSONCheckHMP(mon);
> +        if (ret == 0) {
> +            mon->json_hmp = qemuMonitorJSONCheckHMP(mon);
> +            if (mon->json_hmp < 0) {
> +                /* qemu may quited unexpectedly when we call
> +                 * qemuMonitorJSONCheckHMP() */
> +                ret = -1;
> +            }
> +        }

This shouldn't really work since mon->json_hmp is declared as
    unsigned json_hmp: 1;

I think we need something like

    if (ret == 0) {
        int hmp = qemuMonitorJSONCheckHMP(mon);
        if (hmp < 0) {
            ...
        } else {
            mon->json_hmp = hmp > 0;
        }
    }

Jirka

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]