From 170b7275c07ade473ba6f324305972517cbf1c96 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 16 Aug 2013 14:36:32 -0500 Subject: [svn-r24015] A bug fix when merging changes from the trunk to 1.8 for h5stat bug fix HDFFV-1238: Fix a problem when using opt_arg that is NULL for the new options added: -l N, -m N, -a N. h5committested. --- tools/h5stat/h5stat.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 6fc1dc4..a5d7eef 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -915,11 +915,14 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) break; case 'l': - sgroups_threshold = HDatoi(opt_arg); - if(sgroups_threshold < 1) { - error_msg("Invalid threshold for small groups\n"); - goto error; - } /* end if */ + if(opt_arg) { + sgroups_threshold = HDatoi(opt_arg); + if(sgroups_threshold < 1) { + error_msg("Invalid threshold for small groups\n"); + goto error; + } + } else + error_msg("Missing threshold for small groups\n"); break; @@ -934,11 +937,14 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) break; case 'm': - sdsets_threshold = HDatoi(opt_arg); - if(sdsets_threshold < 1) { - error_msg("Invalid threshold for small datasets\n"); - goto error; - } /* end if */ + if(opt_arg) { + sdsets_threshold = HDatoi(opt_arg); + if(sdsets_threshold < 1) { + error_msg("Invalid threshold for small datasets\n"); + goto error; + } + } else + error_msg("Missing threshold for small datasets\n"); break; @@ -953,11 +959,14 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) break; case 'a': - sattrs_threshold = HDatoi(opt_arg); - if(sattrs_threshold < 1) { - error_msg("Invalid threshold for small # of attributes\n"); - goto error; - } /* end if */ + if(opt_arg) { + sattrs_threshold = HDatoi(opt_arg); + if(sattrs_threshold < 1) { + error_msg("Invalid threshold for small # of attributes\n"); + goto error; + } + } else + error_msg("Missing threshold for small # of attributes\n"); break; -- cgit v0.12