summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2008-12-15 21:17:38 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2008-12-15 21:17:38 (GMT)
commit86fb2794d6b12431edcd2a57f6c048e7e1c4e628 (patch)
treeb39323faa614d270979657e5621c72008a213c5c /src
parent67d0c24a41ff2a98292f7c6c226cb6f5700d682e (diff)
downloadhdf5-86fb2794d6b12431edcd2a57f6c048e7e1c4e628.zip
hdf5-86fb2794d6b12431edcd2a57f6c048e7e1c4e628.tar.gz
hdf5-86fb2794d6b12431edcd2a57f6c048e7e1c4e628.tar.bz2
[svn-r16202] Added HDlseek in front of the truncate function in H5FD_sec2_truncate for VMS only.
On Open VMS, if the last read or write put the file pointer beyond the current file size (it happens when an object is deleted), the file can be extended when it's truncated. Tested v1.8 on VMS.
Diffstat (limited to 'src')
-rw-r--r--src/H5FDsec2.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 3b09005..093624b 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -885,6 +885,13 @@ HDfprintf(stderr, "%s: file->eof = %a, file->eoa = %a\n", FUNC, file->eof, file-
if(SetEndOfFile((HANDLE)filehandle) == 0)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#else /* _WIN32 */
+#ifdef H5_VMS
+ /* Reset seek offset to the beginning of the file, so that the file isn't
+ * re-extended later. This may happen on Open VMS. */
+ if(HDlseek(file->fd, (file_offset_t)0, SEEK_SET) < 0)
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+#endif
+
if(-1 == HDftruncate(file->fd, (file_offset_t)file->eoa))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* _WIN32 */
@@ -900,4 +907,3 @@ HDfprintf(stderr, "%s: file->eof = %a, file->eoa = %a\n", FUNC, file->eof, file-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_sec2_truncate() */
-