WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 3/3] xl: fix network-detach command line parsing

To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 3/3] xl: fix network-detach command line parsing
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Wed, 02 Jun 2010 16:09:53 -0700
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Wed, 02 Jun 2010 16:13:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc12 Lightning/1.0b2pre Thunderbird/3.0.4
Command line arguments start at argv[2].  Also, exit(1) on failure.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>

diff -r bb9d52825bae tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Jun 02 11:31:36 2010 -0700
+++ b/tools/libxl/xl_cmdimpl.c  Wed Jun 02 11:34:25 2010 -0700
@@ -3436,11 +3436,11 @@
     int opt;
     libxl_device_nic nic;
 
-    if (argc != 3) {
+    if (argc != 4) {
         help("network-detach");
         exit(0);
     }
-    while ((opt = getopt(argc, argv, "hl")) != -1) {
+    while ((opt = getopt(argc, argv, "h")) != -1) {
         switch (opt) {
         case 'h':
             help("network-detach");
@@ -3451,24 +3451,25 @@
         }
     }
 
-    if (domain_qualifier_to_domid(argv[1], &domid, 0) < 0) {
-        fprintf(stderr, "%s is an invalid domain identifier\n", argv[1]);
+    if (domain_qualifier_to_domid(argv[2], &domid, 0) < 0) {
+        fprintf(stderr, "%s is an invalid domain identifier\n", argv[2]);
         exit(1);
     }
 
-    if (!strchr(argv[2], ':')) {
-        if (libxl_devid_to_device_nic(&ctx, domid, argv[2], &nic)) {
-            fprintf(stderr, "Unknown device %s.\n", argv[2]);
+    if (!strchr(argv[3], ':')) {
+        if (libxl_devid_to_device_nic(&ctx, domid, argv[3], &nic)) {
+            fprintf(stderr, "Unknown device %s.\n", argv[3]);
             exit(1);
         }
     } else {
-        if (libxl_mac_to_device_nic(&ctx, domid, argv[2], &nic)) {
-            fprintf(stderr, "Unknown device %s.\n", argv[2]);
+        if (libxl_mac_to_device_nic(&ctx, domid, argv[3], &nic)) {
+            fprintf(stderr, "Unknown device %s.\n", argv[3]);
             exit(1);
         }
     }
     if (libxl_device_nic_del(&ctx, &nic, 1)) {
         fprintf(stderr, "libxl_device_nic_del failed.\n");
+        exit(1);
     }
     exit(0);
 }



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 3/3] xl: fix network-detach command line parsing, Jeremy Fitzhardinge <=