summaryrefslogtreecommitdiffstats
path: root/src/H5MF.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5MF.c')
-rw-r--r--src/H5MF.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/H5MF.c b/src/H5MF.c
index 46d5bae..a50d98f 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -63,6 +63,11 @@ H5MF_alloc(H5F_t *f, intn op, size_t size, haddr_t *addr /*out */ )
assert(size > 0);
assert(addr);
+ /* Fail if we don't have write access */
+ if (0==(f->intent & H5F_ACC_RDWR)) {
+ HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "file is read-only");
+ }
+
/*
* Eventually we'll maintain a free list(s) and try to satisfy requests
* from there. But for now we just allocate more memory from the end of