From 9bf5246f97ba7fdc4b9673bf335daa7a21451b7d Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Wed, 15 May 2013 23:43:04 +0200 Subject: [PATCH] esx: Fix error reporting in esxVI_LookupManagedObjectHelper As the name parameter can be NULL the error message can only contain it conditionally. --- src/esx/esx_vi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 5fd0693838..d0df13d928 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -5140,8 +5140,14 @@ esxVI_LookupManagedObjectHelper(esxVI_Context *ctx, if (candidate == NULL) { if (occurrence != esxVI_Occurrence_OptionalItem) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not find %s with name '%s'"), type, name); + if (name != NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find %s with name '%s'"), type, name); + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find %s"), type); + } + goto cleanup; } -- GitLab