summaryrefslogtreecommitdiffstats
path: root/tools/h5stat/h5stat.c
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2012-06-07 16:04:56 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2012-06-07 16:04:56 (GMT)
commit73db2056a31348fa4c0b14898c5ba66ab214021f (patch)
treed3f4d6e50e790019647684df731be21bb9b99132 /tools/h5stat/h5stat.c
parenta6d41f7a75a8f16e6e0efbcf5efc428299c85483 (diff)
downloadhdf5-73db2056a31348fa4c0b14898c5ba66ab214021f.zip
hdf5-73db2056a31348fa4c0b14898c5ba66ab214021f.tar.gz
hdf5-73db2056a31348fa4c0b14898c5ba66ab214021f.tar.bz2
[svn-r22444] (1) fix for making MEM_GHEAP as MEM_DRAW
(2) fix to extend into the aggregator based on threshold (3) fix for the "flavor" logging problem (4) fix for test failures due to the above fixes (5) bug fix for h5stat when h5stat against a non-existing file
Diffstat (limited to 'tools/h5stat/h5stat.c')
-rw-r--r--tools/h5stat/h5stat.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index 99ea688..a68760d 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -937,36 +937,9 @@ error:
/*-------------------------------------------------------------------------
- * Function: init_iter
+ * Function: iter_free
*
- * Purpose: Initialize iter structure
- *
- * Return: Success: 0
- *
- * Failure: Never fails
- *
- * Programmer: Elena Pourmal
- * Saturday, August 12, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-iter_init(iter_t *iter, hid_t fid)
-{
- /* Clear everything to zeros */
- HDmemset(iter, 0, sizeof(*iter));
-
- /* Set the file ID for later use in callbacks */
- iter->fid = fid;
-
- return 0;
-} /* iter_init() */
-
-
-/*-------------------------------------------------------------------------
- * Function: free_iter
- *
- * Purpose: Freee iter structure
+ * Purpose: Free iter structure
*
* Return: Success: 0
*
@@ -1610,7 +1583,7 @@ main(int argc, const char *argv[])
{
iter_t iter;
const char *fname = NULL;
- hid_t fid;
+ hid_t fid = -1;
hid_t fcpl;
struct handler_t *hand = NULL;
H5F_info2_t finfo;
@@ -1633,6 +1606,8 @@ main(int argc, const char *argv[])
printf("Filename: %s\n", fname);
+ HDmemset(&iter, 0, sizeof(iter));
+
fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);
if(fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
@@ -1641,7 +1616,7 @@ main(int argc, const char *argv[])
} /* end if */
/* Initialize iter structure */
- iter_init(&iter, fid);
+ iter.fid = fid;
if(H5Fget_filesize(fid, &iter.filesize) < 0)
warn_msg("Unable to retrieve file size\n");
@@ -1708,7 +1683,7 @@ done:
/* Free iter structure */
iter_free(&iter);
- if(H5Fclose(fid) < 0) {
+ if(fid >= 0 && H5Fclose(fid) < 0) {
error_msg("unable to close file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
}