summaryrefslogtreecommitdiffstats
path: root/src/H5Lexternal.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2010-03-05 17:24:17 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2010-03-05 17:24:17 (GMT)
commit179b54da83f293948a531afd6b59e676df7a60e7 (patch)
treef57b410bccb7fa311043f7a4451f4ca11d8463d7 /src/H5Lexternal.c
parent3a06e04ac5abb30d241118b83e2fc280e981a0b3 (diff)
downloadhdf5-179b54da83f293948a531afd6b59e676df7a60e7.zip
hdf5-179b54da83f293948a531afd6b59e676df7a60e7.tar.gz
hdf5-179b54da83f293948a531afd6b59e676df7a60e7.tar.bz2
[svn-r18374] Purpose: Fix bugs involving external links
Description: Previously, the library would reopen the source file when traversing an external link if unable to find the target file otherwise. This has been corrected. Also moved the call to H5F_flush from H5F_try_close to H5F_dest, so the file is only flushed when the last identifier for the file is closed. This prevernts situations where the library could attempt to flush a file with protected metadata. Tested: jam, amani, linew (h5committest); Fedora
Diffstat (limited to 'src/H5Lexternal.c')
-rw-r--r--src/H5Lexternal.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index db762cf..7ccdb68 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -412,19 +412,15 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
/* get last component of file_name */
GET_LAST_DELIMITER(actual_file_name, ptr)
- if(ptr) {
- /* Truncate filename portion from actual file name path */
- *ptr = '\0';
+ if(!ptr)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s', temp_file_name = '%s'", file_name, temp_file_name)
- /* Build new file name for the external file */
- if(H5L_build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename")
- } /* end if */
- else {
- /* Transfer ownership of actual file name to 'full_name' variable */
- full_name = actual_file_name;
- actual_file_name = NULL;
- } /* end else */
+ /* Truncate filename portion from actual file name path */
+ *ptr = '\0';
+
+ /* Build new file name for the external file */
+ if(H5L_build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename")
/* Try opening with the resolved name */
if(NULL == (ext_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id)))