summaryrefslogtreecommitdiffstats
path: root/tools/src/misc/h5clear.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2020-10-16 22:47:27 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2020-10-16 22:47:27 (GMT)
commitdb30c2da68ece4a155e9e50c28ec16d6057509b2 (patch)
tree1d36f673c36dfee71c266bba39511da21ecc782e /tools/src/misc/h5clear.c
parent5b9cf732caab9daa6ed1e00f2df4f5a792340196 (diff)
parent2e2b87d1cbdee3b919e6e5cba6c5ecd1b9434434 (diff)
downloadhdf5-db30c2da68ece4a155e9e50c28ec16d6057509b2.zip
hdf5-db30c2da68ece4a155e9e50c28ec16d6057509b2.tar.gz
hdf5-db30c2da68ece4a155e9e50c28ec16d6057509b2.tar.bz2
Merge HDF5 1.10.7 release files into 1.10/masterhdf5-1_10_7
Diffstat (limited to 'tools/src/misc/h5clear.c')
-rw-r--r--tools/src/misc/h5clear.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c
index ae57031..96cbf9c 100644
--- a/tools/src/misc/h5clear.c
+++ b/tools/src/misc/h5clear.c
@@ -101,8 +101,13 @@ static void usage(const char *prog)
HDfprintf(stdout, " -s, --status Clear the status_flags field in the file's superblock\n");
HDfprintf(stdout, " -m, --image Remove the metadata cache image from the file\n");
HDfprintf(stdout, " --filesize Print the file's EOA and EOF\n");
- HDfprintf(stdout, " --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for the file <file_name>\n");
- HDfprintf(stdout, " C is >= 0; C is optional and will default to 1M when not set");
+ HDfprintf(stdout, " --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for\n");
+ HDfprintf(stdout, " the file <file_name>.\n");
+ HDfprintf(stdout, " C is >= 0; C is optional and will default to 1M when not set.\n");
+ HDfprintf(stdout, " This option helps to repair a crashed file where the stored EOA\n");
+ HDfprintf(stdout, " in the superblock is different from the actual EOF.\n");
+ HDfprintf(stdout, " The file’s EOA and EOF will be the same after applying\n");
+ HDfprintf(stdout, " this option to the file.\n");
HDfprintf(stdout, "\n");
HDfprintf(stdout, "Examples of use:\n");
HDfprintf(stdout, "\n");
@@ -175,7 +180,7 @@ parse_command_line(int argc, const char **argv)
usage(h5tools_getprogname());
goto done;
}
- increment = HDatoi(opt_arg);
+ increment = (hsize_t)HDatoi(opt_arg);
}
break;
@@ -252,8 +257,8 @@ int
main (int argc, const char *argv[])
{
char *fname = NULL; /* File name */
- hid_t fapl = -1; /* File access property list */
- hid_t fid = -1; /* File ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
haddr_t image_addr;
hsize_t image_len;
unsigned flags = H5F_ACC_RDWR; /* file access flags */
@@ -261,9 +266,6 @@ main (int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable the HDF5 library's error reporting */
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* initialize h5tools lib */
h5tools_init();
@@ -274,6 +276,9 @@ main (int argc, const char *argv[])
if(fname_g == NULL)
goto done;
+ /* enable error reporting if command line option */
+ h5tools_error_report();
+
/* Print usage/exit if not using at least one of the options */
if(!clear_status_flags && !remove_cache_image &&
!increment_eoa_eof && !print_filesize) {
@@ -339,7 +344,7 @@ main (int argc, const char *argv[])
}
/* Open the file */
- if((fid = h5tools_fopen(fname, flags, fapl, NULL, NULL, (size_t)0)) < 0) {
+ if((fid = h5tools_fopen(fname, flags, fapl, FALSE, NULL, (size_t)0)) < 0) {
error_msg("h5tools_fopen\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -380,7 +385,6 @@ main (int argc, const char *argv[])
warn_msg("No cache image in the file\n");
}
-
h5tools_setstatus(EXIT_SUCCESS);
done: