summaryrefslogtreecommitdiffstats
path: root/test/links.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2006-08-24 00:52:21 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2006-08-24 00:52:21 (GMT)
commit9edac8a668f823aa7a60a97e4332216619609ba5 (patch)
treed3ba30d52bdaac0270ea68046cddeac8938765dc /test/links.c
parentafb817a0a71058e02625fb67f3935ddd33a48404 (diff)
downloadhdf5-9edac8a668f823aa7a60a97e4332216619609ba5.zip
hdf5-9edac8a668f823aa7a60a97e4332216619609ba5.tar.gz
hdf5-9edac8a668f823aa7a60a97e4332216619609ba5.tar.bz2
[svn-r12623] Added H5Fget_intent() function to get the "intent" of a file (read/write or
read-only). Added this to external links, so that external files are opened with the same intent as the source file. Added tests.
Diffstat (limited to 'test/links.c')
-rw-r--r--test/links.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/links.c b/test/links.c
index 2cbb282..61648bf 100644
--- a/test/links.c
+++ b/test/links.c
@@ -1579,7 +1579,7 @@ external_link_root(hid_t fapl)
if(H5Gclose(gid) < 0) TEST_ERROR;
if(H5Fclose(fid)<0) TEST_ERROR;
- /* Open first file again and check on objects created */
+ /* Open first file again with read-only access and check on objects created */
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
/* Open objects created through external link */
@@ -1599,13 +1599,26 @@ external_link_root(hid_t fapl)
/* Close first file */
if(H5Fclose(fid)<0) TEST_ERROR;
+ /* Verify that new objects can't be created through a read-only external
+ * link.
+ */
+ if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ H5E_BEGIN_TRY {
+ gid = H5Gcreate(fid, "ext_link/readonly_group", (size_t)0);
+ } H5E_END_TRY
+ if(gid >= 0) TEST_ERROR
+
+ /* Close second file again */
+ if(H5Fclose(fid)<0) TEST_ERROR;
+
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Fclose (gid2);
- H5Fclose (gid);
+ H5Gclose (gid2);
+ H5Gclose (gid);
H5Fclose (fid);
} H5E_END_TRY;
return -1;