[PATCH] esx: Fix error reporting in esxVI_LookupManagedObjectHelper

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

 



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

--
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]