[libvirt] [PATCH 1/2] tools: use vshError rather than vshPrint on failure

Erik Skultety eskultet at redhat.com
Fri Nov 11 14:51:54 UTC 2016


There were a few places in our virsh* code where instead of calling vshError
on failure we called vshPrint.

Signed-off-by: Erik Skultety <eskultet at redhat.com>
---
 tools/virsh-volume.c | 2 +-
 tools/vsh.c          | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index e8cef39..8831f44 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -605,7 +605,7 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd)
 
     newxml = virshMakeCloneXML(origxml, name);
     if (!newxml) {
-        vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+        vshError(ctl, "%s", _("Failed to allocate XML buffer"));
         goto cleanup;
     }
 
diff --git a/tools/vsh.c b/tools/vsh.c
index 3ba09dd..f69c6dd 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -3269,7 +3269,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
         if (xml) {
             virBufferEscapeString(&xmlbuf, "%s", arg);
             if (virBufferError(&xmlbuf)) {
-                vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+                vshError(ctl, "%s", _("Failed to allocate XML buffer"));
                 return false;
             }
             str = virBufferContentAndReset(&xmlbuf);
@@ -3286,7 +3286,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
     }
 
     if (virBufferError(&buf)) {
-        vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+        vshError(ctl, "%s", _("Failed to allocate XML buffer"));
         return false;
     }
     arg = virBufferContentAndReset(&buf);
-- 
2.5.5




More information about the libvir-list mailing list