diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2013-08-16 19:36:32 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2013-08-16 19:36:32 (GMT) |
commit | 170b7275c07ade473ba6f324305972517cbf1c96 (patch) | |
tree | 71e36254837439cac4ee3931c0721f870dc54a92 | |
parent | 453f95c192ee8db44299b02abf95698e8bf247ce (diff) | |
download | hdf5-170b7275c07ade473ba6f324305972517cbf1c96.zip hdf5-170b7275c07ade473ba6f324305972517cbf1c96.tar.gz hdf5-170b7275c07ade473ba6f324305972517cbf1c96.tar.bz2 |
[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.
-rw-r--r-- | tools/h5stat/h5stat.c | 39 |
1 files 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; |