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-changelog

[Xen-changelog] [xen-unstable] xl: fix network-detach command line parsi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: fix network-detach command line parsing
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 04 Jun 2010 03:45:25 -0700
Delivery-date: Fri, 04 Jun 2010 03:47:13 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1275642645 -3600
# Node ID e07e68840b8478880e30c06ac92145af68455eec
# Parent  c005ef20189e3d4a989be64eb9d31a6eda831240
xl: fix network-detach command line parsing

Command line arguments start at argv[2].  Also, exit(1) on failure.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff -r c005ef20189e -r e07e68840b84 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri Jun 04 10:10:25 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Fri Jun 04 10:10:45 2010 +0100
@@ -3508,11 +3508,11 @@ int main_networkdetach(int argc, char **
     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");
@@ -3523,24 +3523,25 @@ int main_networkdetach(int argc, char **
         }
     }
 
-    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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xl: fix network-detach command line parsing, Xen patchbot-unstable <=