From: Marcos Paulo de Souza Date: Tue, 3 Jul 2018 02:20:58 +0000 (-0300) Subject: esx_vi.c: Simplify error handling in MachineByName X-Git-Tag: v4.6.0-rc1~335 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00d9edfe2f39f60b40c0a0e16a1709e9633ab988;p=thirdparty%2Flibvirt.git esx_vi.c: Simplify error handling in MachineByName The same pattern is used in lots of other places. Also, reporting error message is not desired because all callers check the return value and report errors on their own. Signed-off-by: Marcos Paulo de Souza Signed-off-by: Michal Privoznik --- diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 43ff7ea048..0bdfc5a8be 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -3014,17 +3014,8 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name, break; } - if (!(*virtualMachine)) { - if (occurrence == esxVI_Occurrence_OptionalItem) { - result = 0; - - goto cleanup; - } else { - virReportError(VIR_ERR_NO_DOMAIN, - _("Could not find domain with name '%s'"), name); - goto cleanup; - } - } + if (!(*virtualMachine) && occurrence != esxVI_Occurrence_OptionalItem) + goto cleanup; result = 0;