[libvirt] [PATCHv2 4/4] qemu: fix a error coverd issue in 2 place

John Ferlan jferlan at redhat.com
Sun Mar 8 23:51:33 UTC 2015



On 02/28/2015 04:08 AM, Luyao Huang wrote:
> we already set a more clearly error in networkGetNetworkAddress,
> so this error will cover our error in networkGetNetworkAddress.
> 
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---
>  src/qemu/qemu_command.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 

Change comment to:

Remove unnecessary virReportError on networkGetNetworkAddress return

More specific errors are set in the called functions when -1 is
returned, so don't overwrite those messages.

Code seems fine and I traced functions as well.

John

> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 82a4ce3..cd0758d 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7295,12 +7295,9 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
>                                         "network driver not present"));
>                  goto error;
>              }
> -            if (ret < 0) {
> -                virReportError(VIR_ERR_XML_ERROR,
> -                               _("listen network '%s' had no usable address"),
> -                               listenNetwork);
> +            if (ret < 0)
>                  goto error;
> -            }
> +
>              listenAddr = netAddr;
>              /* store the address we found in the <graphics> element so it will
>               * show up in status. */
> @@ -7461,12 +7458,9 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
>                                     "network driver not present"));
>              goto error;
>          }
> -        if (ret < 0) {
> -            virReportError(VIR_ERR_XML_ERROR,
> -                           _("listen network '%s' had no usable address"),
> -                           listenNetwork);
> +        if (ret < 0)
>              goto error;
> -        }
> +
>          listenAddr = netAddr;
>          /* store the address we found in the <graphics> element so it will
>           * show up in status. */
> 




More information about the libvir-list mailing list