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: fixup "xl save" command line handling

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: fixup "xl save" command line handling.
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Wed, 28 Sep 2011 02:55:23 +0100
Delivery-date: Tue, 27 Sep 2011 18:58:00 -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 Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1317141136 -3600
# Node ID b113d626cfaf7c8faa7be9d528816ed944e59ba8
# Parent  ade44be5b9364b66d76ad9448d158c26444c4d61
xl: fixup "xl save" command line handling.

The save file paramter is required so ensure we have enough arguments.

The config filename is optional so do not use argv[optind+3], which
may well happen to be NULL when the paramter is not present but
relying on that is pretty gross.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r ade44be5b936 -r b113d626cfaf tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Sep 27 16:15:09 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue Sep 27 17:32:16 2011 +0100
@@ -2856,8 +2856,8 @@
 
 int main_save(int argc, char **argv)
 {
-    const char *filename = NULL, *p = NULL;
-    const char *config_filename;
+    const char *filename, *p;
+    const char *config_filename = NULL;
     int checkpoint = 0;
     int opt;
 
@@ -2871,14 +2871,16 @@
         }
     }
 
-    if (argc-optind > 3) {
+    if (argc-optind < 2 || argc-optind > 3) {
         help("save");
         return 2;
     }
 
     p = argv[optind];
     filename = argv[optind + 1];
-    config_filename = argv[optind + 2];
+    if ( argc - optind >= 3 )
+        config_filename = argv[optind + 2];
+
     save_domain(p, filename, checkpoint, config_filename);
     return 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: fixup "xl save" command line handling., Xen patchbot-unstable <=