summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorJordan Henderson <jhenderson@hdfgroup.org>2020-03-29 17:37:14 (GMT)
committerJordan Henderson <jhenderson@hdfgroup.org>2020-03-29 17:37:14 (GMT)
commit9676029742f18aaae37dd48947bc1faf23406169 (patch)
treed0f11c3c3272a92cefc7bb5c9e64d994e35a26a2 /tools/src
parent2a06f943779fd3cc04d93ad6ec9a94a28035c50d (diff)
downloadhdf5-9676029742f18aaae37dd48947bc1faf23406169.zip
hdf5-9676029742f18aaae37dd48947bc1faf23406169.tar.gz
hdf5-9676029742f18aaae37dd48947bc1faf23406169.tar.bz2
Fix latent bug in h5repack options file reading
Add 'enable-error-stack' option to h5format_convert
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5format_convert/h5format_convert.c95
-rw-r--r--tools/src/h5repack/h5repack_main.c2
2 files changed, 52 insertions, 45 deletions
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index 01e7fe0..ae72ea9 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -42,13 +42,13 @@ static int verbose_g = 0;
static const char *s_opts = "hVvd:n";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
- { "hel", no_arg, 'h'},
- { "he", no_arg, 'h'},
+ { "hel", no_arg, 'h'},
+ { "he", no_arg, 'h'},
{ "version", no_arg, 'V' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
+ { "version", no_arg, 'V' },
+ { "versio", no_arg, 'V' },
+ { "versi", no_arg, 'V' },
+ { "vers", no_arg, 'V' },
{ "verbose", no_arg, 'v' },
{ "verbos", no_arg, 'v' },
{ "verbo", no_arg, 'v' },
@@ -60,6 +60,7 @@ static struct long_options l_opts[] = {
{ "noop", no_arg, 'n' },
{ "noo", no_arg, 'n' },
{ "no", no_arg, 'n' },
+ { "enable-error-stack", no_arg, 'E' },
{ NULL, 0, '\0' }
};
@@ -120,55 +121,59 @@ parse_command_line(int argc, const char **argv)
/* no arguments */
if (argc == 1) {
usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
goto error;
}
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char) opt) {
- case 'h':
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_SUCCESS);
- goto error;
-
- case 'V':
- print_version(h5tools_getprogname());
- h5tools_setstatus(EXIT_SUCCESS);
- goto error;
-
- case 'v':
- verbose_g = TRUE;
- break;
-
- case 'd': /* -d dname */
- if(opt_arg != NULL && *opt_arg)
- dname_g = HDstrdup(opt_arg);
- if(dname_g == NULL) {
- h5tools_setstatus(EXIT_FAILURE);
- error_msg("No dataset name\n", opt_arg);
- usage(h5tools_getprogname());
- goto error;
- }
- dset_g = TRUE;
- break;
-
- case 'n': /* -n */
- noop_g = TRUE;
- break;
-
- default:
- h5tools_setstatus(EXIT_FAILURE);
- usage(h5tools_getprogname());
- goto error;
- break;
- } /* switch */
+ switch((char) opt) {
+ case 'h':
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto error;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto error;
+
+ case 'v':
+ verbose_g = TRUE;
+ break;
+
+ case 'd': /* -d dname */
+ if(opt_arg != NULL && *opt_arg)
+ dname_g = HDstrdup(opt_arg);
+ if(dname_g == NULL) {
+ h5tools_setstatus(EXIT_FAILURE);
+ error_msg("No dataset name\n", opt_arg);
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ dset_g = TRUE;
+ break;
+
+ case 'n': /* -n */
+ noop_g = TRUE;
+ break;
+
+ case 'E':
+ enable_error_stack = 1;
+ break;
+
+ default:
+ h5tools_setstatus(EXIT_FAILURE);
+ usage(h5tools_getprogname());
+ goto error;
+ break;
+ } /* switch */
} /* while */
if (argc <= opt_ind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
goto error;
}
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 44b4b6c..f0a94ab 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -311,6 +311,8 @@ int read_info(const char *filename, pack_opt_t *options)
/* cycle until end of file reached */
while (1) {
+ if (EOF == fscanf(fp, "%9s", stype))
+ break;
/* Info indicator must be for layout or filter */
if (HDstrcmp(stype,"-l") && HDstrcmp(stype, "-f")) {