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
|