diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2008-12-15 20:40:24 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2008-12-15 20:40:24 (GMT) |
commit | 9c5100ced34fdd6e0e8738b4320f3d5c9e86bd65 (patch) | |
tree | f0a4b092df15df1332c08986343b66ac7e03c497 | |
parent | ef857fa7d78424560456af2bb03743658930367c (diff) | |
download | hdf5-9c5100ced34fdd6e0e8738b4320f3d5c9e86bd65.zip hdf5-9c5100ced34fdd6e0e8738b4320f3d5c9e86bd65.tar.gz hdf5-9c5100ced34fdd6e0e8738b4320f3d5c9e86bd65.tar.bz2 |
[svn-r16199] 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 on VMS.
-rw-r--r-- | src/H5FDsec2.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 3b09005..407f0f2 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -863,7 +863,7 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_sec2_truncate, FAIL) -#ifdef QAK +#ifndef QAK HDfprintf(stderr, "%s: file->eof = %a, file->eoa = %a\n", FUNC, file->eof, file->eoa); #endif /* QAK */ @@ -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 */ |