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

Re: [libvirt] [PATCH] virsh: say save-image-edit failed only when it does



On 2012年08月10日 21:20, Ján Tomko wrote:
The common code for editing files in virsh-edit.c expects EDIT_DEFINE to
return 0 on failure. virDomainSaveImageDefineXML returns 0 on success.
---
  tools/virsh-domain.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 33b1727..69e0133 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2973,7 +2973,7 @@ cmdSaveImageEdit(vshControl *ctl, const vshCmd *cmd)
                      "not changed.\n"), file);           \
      ret = true; goto edit_cleanup;
  #define EDIT_DEFINE \
-    virDomainSaveImageDefineXML(ctl->conn, file, doc_edited, define_flags)
+    (virDomainSaveImageDefineXML(ctl->conn, file, doc_edited, define_flags) == 0)
  #define EDIT_FREE /* */
  #include "virsh-edit.c"


I think the more reliable way is to let the codes in virsh-edit.c
known what the expected return value is and check if the edit
succeeds or not by it.

But seems virDomainSaveImageDefineXML is the only *Define API
which returns 0 on success. so ACK and pushed.

Regards,
Osier


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