diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/src/h5repack/h5repack_copy.c | 67 | ||||
-rw-r--r-- | tools/test/h5copy/dynlib_copy.c | 2 | ||||
-rw-r--r-- | tools/test/h5diff/dynlib_diff.c | 2 | ||||
-rw-r--r-- | tools/test/h5dump/dynlib_dump.c | 2 | ||||
-rw-r--r-- | tools/test/h5dump/h5dumpgentest.c | 2 | ||||
-rw-r--r-- | tools/test/h5ls/dynlib_ls.c | 2 |
6 files changed, 51 insertions, 26 deletions
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 4c45549..ffb4844 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -305,14 +305,6 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options) H5TOOLS_GOTO_ERROR((-1), "H5Fcreate could not create file <%s>:", fnameout); /*------------------------------------------------------------------------- - * write a new user block if requested - *------------------------------------------------------------------------- - */ - if (options->ublock_size > 0) - if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) - H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); - - /*------------------------------------------------------------------------- * get list of objects *------------------------------------------------------------------------- */ @@ -346,27 +338,60 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options) } /*------------------------------------------------------------------------- - * write only the input file user block if there is no user block file input + * Close the file and everything in it so the lock is removed + *------------------------------------------------------------------------- + */ + if (H5Pclose(fcpl) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Pclose(options->fout_fapl) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + options->fout_fapl = H5P_DEFAULT; + if (H5Pclose(gcpl_in) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Gclose(grp_in) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Fclose(fidout) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + if (H5Fclose(fidin) < 0) + H5TOOLS_GOTO_ERROR((-1), "could not close fcpl"); + + /*------------------------------------------------------------------------- + * NOTE: The userblock MUST be written out AFTER the file is closed or + * the file locking will cause failures on Windows, where file locks + * are mandatory, not advisory. + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * Write a new user block if requested, using the input file user block if + * there is no separate user block file input *------------------------------------------------------------------------- */ - if (ub_size > 0 && options->ublock_size == 0) + if (options->ublock_size > 0) { + if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) + H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); + } + else if (ub_size > 0 && options->ublock_size == 0) { if (copy_user_block(fnamein, fnameout, ub_size) < 0) H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); + } done: - H5E_BEGIN_TRY - { - H5Pclose(fcpl); - H5Pclose(options->fout_fapl); - options->fout_fapl = H5P_DEFAULT; - H5Pclose(gcpl_in); - H5Gclose(grp_in); - H5Pclose(fcpl_in); - H5Fclose(fidout); - H5Fclose(fidin); + if (-1 == ret_value) { + H5E_BEGIN_TRY + { + H5Pclose(fcpl); + H5Pclose(options->fout_fapl); + options->fout_fapl = H5P_DEFAULT; + H5Pclose(gcpl_in); + H5Gclose(grp_in); + H5Pclose(fcpl_in); + H5Fclose(fidout); + H5Fclose(fidin); + } + H5E_END_TRY; } - H5E_END_TRY; if (travt) trav_table_free(travt); diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c index d6e91fc..b954a22 100644 --- a/tools/test/h5copy/dynlib_copy.c +++ b/tools/test/h5copy/dynlib_copy.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index ce65f24..433522d 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index ce65f24..433522d 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index ff1598d..a4ad058 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -10884,7 +10884,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index ce65f24..433522d 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -70,7 +70,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ |