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

[Xen-changelog] [xen master] xl: Command line: Adjust "Fix segfaults from `xl psr-cat-cbm-set`..."



commit e424bff91b067e0d1e8eb8f8efa38f63c822c5b2
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Fri Jul 17 18:00:47 2015 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Tue Jul 21 16:03:16 2015 +0100

    xl: Command line: Adjust "Fix segfaults from `xl psr-cat-cbm-set`..."
    
    This adjust commit a49077e5 "Fix segfaults from `xl psr-cat-cbm-set`
    command line handling":
    
     * Do not use the constant `required_argument' here (we simply use 1
       everywhere else).
    
     * Fix the minimum required arguments argument to SWITCH_FOREACH_OPT.
    
    Leave the separate check on optind, because it checks for too many as
    well as too few arguments.
    
    (There are many things in xl which fail to check for too many
    arguments.  I do not intend to drain that swamp now: I started but
    decided a complete overhaul of most of xl's command line argument
    processing would be best.)
    
    This is just a code cleanup with no ultimate functional change.
    
    Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    CC: Chao Peng <chao.p.peng@xxxxxxxxxxxxxxx>
    CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 8cbf30e..4e97449 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -8431,7 +8431,7 @@ int main_psr_cat_cbm_set(int argc, char **argv)
     int i, j, len;
 
     static struct option opts[] = {
-        {"socket", required_argument, 0, 's'},
+        {"socket", 1, 0, 's'},
         COMMON_LONG_OPTS,
         {0, 0, 0, 0}
     };
@@ -8439,7 +8439,7 @@ int main_psr_cat_cbm_set(int argc, char **argv)
     libxl_socket_bitmap_alloc(ctx, &target_map, 0);
     libxl_bitmap_set_none(&target_map);
 
-    SWITCH_FOREACH_OPT(opt, "s:", opts, "psr-cat-cbm-set", 1) {
+    SWITCH_FOREACH_OPT(opt, "s:", opts, "psr-cat-cbm-set", 2) {
     case 's':
         trim(isspace, optarg, &value);
         split_string_into_string_list(value, ",", &socket_list);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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