xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] xl: Command line: Adjust "Fix segfaults from `xl psr-cat-cbm-set`..."
@ 2015-07-17 17:00 Ian Jackson
  2015-07-17 17:00 ` [PATCH 2/5] xl: Command line: Remove maximum argument limit for network-attach Ian Jackson
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Ian Jackson @ 2015-07-17 17:00 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Andrew Cooper, Wei Liu, Ian Campbell, Chao Peng

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@eu.citrix.com>
CC: Chao Peng <chao.p.peng@linux.intel.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libxl/xl_cmdimpl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 7949202..55c041c 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -8397,7 +8397,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}
     };
@@ -8405,7 +8405,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);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-07-24 11:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-17 17:00 [PATCH 1/5] xl: Command line: Adjust "Fix segfaults from `xl psr-cat-cbm-set`..." Ian Jackson
2015-07-17 17:00 ` [PATCH 2/5] xl: Command line: Remove maximum argument limit for network-attach Ian Jackson
2015-07-20 10:00   ` Wei Liu
2015-07-17 17:00 ` [PATCH 3/5] xl: Command line: Support -h everywhere Ian Jackson
2015-07-20 10:06   ` Wei Liu
2015-07-17 17:00 ` [PATCH 4/5] xl: Command line: Make COMMON_LONG_OPTS include sentinel Ian Jackson
2015-07-17 17:09   ` Andrew Cooper
2015-07-17 17:11     ` Ian Jackson
2015-07-24 11:06       ` Ian Campbell
2015-07-17 17:00 ` [PATCH 5/5] xl: Command line: Support xl vcpu-set --help Ian Jackson
2015-07-20 10:07   ` Wei Liu
2015-07-17 17:04 ` [PATCH 1/5] xl: Command line: Adjust "Fix segfaults from `xl psr-cat-cbm-set`..." Andrew Cooper
2015-07-21 14:16 ` Ian Campbell
2015-07-21 14:27   ` Ian Jackson
2015-07-21 14:36     ` Wei Liu
2015-07-21 15:26       ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).