summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2002-10-15 05:23:54 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2002-10-15 05:23:54 (GMT)
commit22d4e6a05dba955bd74f3ae1dd52bef3876eef64 (patch)
tree999c5b50d7efb7788c182b2664a1a7606ae8bc3d /tools/h5dump
parenta6b33e6dd73bcc3c7cc5bdc4fb9bdcc363e48a4f (diff)
downloadhdf5-22d4e6a05dba955bd74f3ae1dd52bef3876eef64.zip
hdf5-22d4e6a05dba955bd74f3ae1dd52bef3876eef64.tar.gz
hdf5-22d4e6a05dba955bd74f3ae1dd52bef3876eef64.tar.bz2
[svn-r6000] Purpose:
Bug fix (ID 765 and part of ID 841) Description: "h5dump -H" would core dump. It was because the code was not checking if there was any file argument after option parsing. It referred to an non-existing filename argument. There was also some very old but not commented code which allowed the use of back slash to escape a filename begun with '-'. The '--' option is better and more common practice. Solution: Added code to check if there is still a filename argument after parsing. (This checking probably should goto inside the option_parsing routine. Also removed that old code mentioned above. Platforms tested: eirene, arabica and modi4
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 4cf3181..972d998 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2740,10 +2740,12 @@ main(int argc, const char *argv[])
}
}
- if (argv[opt_ind][0] == '\\')
- fname = &argv[opt_ind][1];
- else
- fname = argv[opt_ind];
+ if (argc <= opt_ind) {
+ error_msg(progname, "missing file name\n");
+ usage(progname);
+ exit(EXIT_FAILURE);
+ }
+ fname = argv[opt_ind];
fid = h5tools_fopen(fname, driver, NULL, 0);