Message ID | 20170120105420.3528-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 2017-01-20 06:54 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > An earlier commit remove the arg parameter sanity range checking > which should be re-instated. Add the code back. > > Fixes: 973a296cad30 ("v2 - lib: fwts_args: handle cases to set optarg_handler for long options.") > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_args.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c > index 5d47547..fec656f 100644 > --- a/src/lib/src/fwts_args.c > +++ b/src/lib/src/fwts_args.c > @@ -212,6 +212,16 @@ int fwts_args_parse(fwts_framework *fw, const int argc, char * const argv[]) > } > } > > + /* We've collected all the args, now sanity check the values */ > + > + fwts_list_foreach(item, &options_list) { > + options_table = fwts_list_data(fwts_options_table *, item); > + if (options_table->optarg_check != NULL) { > + ret = options_table->optarg_check(fw); > + if (ret != FWTS_OK) > + break; > + } > + } > exit: > free(short_options); > free(long_options); > Acked-by: Alex Hung <alex.hung@canonical.com>
On 2017年01月20日 18:54, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > An earlier commit remove the arg parameter sanity range checking > which should be re-instated. Add the code back. > > Fixes: 973a296cad30 ("v2 - lib: fwts_args: handle cases to set optarg_handler for long options.") > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_args.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c > index 5d47547..fec656f 100644 > --- a/src/lib/src/fwts_args.c > +++ b/src/lib/src/fwts_args.c > @@ -212,6 +212,16 @@ int fwts_args_parse(fwts_framework *fw, const int argc, char * const argv[]) > } > } > > + /* We've collected all the args, now sanity check the values */ > + > + fwts_list_foreach(item, &options_list) { > + options_table = fwts_list_data(fwts_options_table *, item); > + if (options_table->optarg_check != NULL) { > + ret = options_table->optarg_check(fw); > + if (ret != FWTS_OK) > + break; > + } > + } > exit: > free(short_options); > free(long_options); > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c index 5d47547..fec656f 100644 --- a/src/lib/src/fwts_args.c +++ b/src/lib/src/fwts_args.c @@ -212,6 +212,16 @@ int fwts_args_parse(fwts_framework *fw, const int argc, char * const argv[]) } } + /* We've collected all the args, now sanity check the values */ + + fwts_list_foreach(item, &options_list) { + options_table = fwts_list_data(fwts_options_table *, item); + if (options_table->optarg_check != NULL) { + ret = options_table->optarg_check(fw); + if (ret != FWTS_OK) + break; + } + } exit: free(short_options); free(long_options);