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

Re: [libvirt] [PATCH] Fix virsh command 'cd'.



On 03/11/2010 06:00 PM, Chris Lalancette wrote:
cmdCd was returning a 0 on success and -1 on error, when
the rest of the code expected a TRUE on success and a
FALSE on error.  Fix the discrepancy.

Signed-off-by: Chris Lalancette<clalance redhat com>
---
  tools/virsh.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index a47edd5..c6e3f2a 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -7469,7 +7469,7 @@ cmdCd(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)

      if (!ctl->imode) {
          vshError(ctl, "%s", _("cd: command valid only in interactive mode"));
-        return -1;
+        return FALSE;
      }

      dir = vshCommandOptString(cmd, "dir",&found);
@@ -7482,10 +7482,10 @@ cmdCd(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)

      if (chdir (dir) == -1) {
          vshError(ctl, _("cd: %s: %s"), strerror(errno), dir);
-        return -1;
+        return FALSE;
      }

-    return 0;
+    return TRUE;
  }

  #endif

ACK.

I verified the error before applying, and absence of error afterwards, as well as passage of make syntax-check and no new compiler warnings.

Strange that virsh doesn't follow the convention of almost all the rest of libvirt.


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