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

[libvirt] [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 5fd0693..d0df13d 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;
         }
 
-- 
1.7.9.5


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