]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx: Fix error reporting in esxVI_LookupManagedObjectHelper
authorMatthias Bolte <matthias.bolte@googlemail.com>
Wed, 15 May 2013 21:43:04 +0000 (23:43 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 17 May 2013 18:14:27 +0000 (20:14 +0200)
As the name parameter can be NULL the error message can only contain it
conditionally.

src/esx/esx_vi.c

index 5fd0693838cc0614899b5bc47f60b0519b122b54..d0df13d928ab4b05d54cb461fb0a843e604b50d3 100644 (file)
@@ -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;
         }