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

[Xen-tools] [PATCH] xm: move bogus arg check inside lenth check


  • To: xen-tools@xxxxxxxxxxxxxxxxxxx
  • From: Ryan Harper <ryanh@xxxxxxxxxx>
  • Date: Fri, 26 Aug 2005 15:21:58 -0500
  • Delivery-date: Fri, 26 Aug 2005 20:21:13 +0000
  • List-id: Xen control tools developers <xen-tools.lists.xensource.com>

I encountered the following error with xm:

(bebop) xm-test # xm list
Traceback (most recent call last):
  File "/usr/sbin/xm", line 10, in ?
    main.main(sys.argv)
  File 
"/home/rharper/work/openhype/xen/unstable/hg/hotplug/dist/install/usr/lib/python/xen/xm/main.py",
 line 718, in main
    if args[0] == "bogus":
IndexError: list index out of range

Moving the bogus check inside the length check cleans that up.

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx


diffstat output:
 main.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
diff -r 2b95125015a5 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Aug 26 13:06:49 2005
+++ b/tools/python/xen/xm/main.py       Fri Aug 26 15:16:21 2005
@@ -715,9 +715,9 @@
             err("Most commands need root access.  Please try again as root")
             sys.exit(1)
         except XendError, ex:
-            if args[0] == "bogus":
-                args.remove("bogus")
             if len(args) > 0:
+                if args[0] == "bogus":
+                    args.remove("bogus")
                 handle_xend_error(argv[1], args[0], ex)
             else:
                 print "Unexpected error:", sys.exc_info()[0]

_______________________________________________
Xen-tools mailing list
Xen-tools@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-tools


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.