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

Daniel Veillard veillard at redhat.com
Fri Mar 12 11:04:43 UTC 2010


On Fri, Mar 12, 2010 at 12:03:42AM -0500, Laine Stump wrote:
> 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 at 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.

  I pushed that one too, looks fine !

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

  Well this part of virsh code was done a long time ago, and
that works so ... :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list