summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2008-12-22 19:01:29 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2008-12-22 19:01:29 (GMT)
commit18197d347136ce5c4fabedf3b8643449e7ba7c4a (patch)
tree187ab334bc48a76ed3e999fd74c8a1657204480e /src
parentec9ff804e2159c15cbc9660b528873a79afbf139 (diff)
downloadhdf5-18197d347136ce5c4fabedf3b8643449e7ba7c4a.zip
hdf5-18197d347136ce5c4fabedf3b8643449e7ba7c4a.tar.gz
hdf5-18197d347136ce5c4fabedf3b8643449e7ba7c4a.tar.bz2
[svn-r16213] Added HDlseek to the H5FD_core_truncate function in H5FDcore.c to rewind the file pointer
to the beginning of the file. Otherwise, the file might be re-extended later on Open VMS. Also updated the return value for the HDlseek to be more appropriate. Tested on Open VMS.
Diffstat (limited to 'src')
-rw-r--r--src/H5FDcore.c7
-rw-r--r--src/H5FDsec2.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 68a0655..9ecb6f5 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -985,6 +985,13 @@ if(file->eof < new_eof)
/* Update backing store, if using it */
if(file->fd >= 0 && file->backing_store) {
+#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(-1 == HDlseek(file->fd, 0, SEEK_SET))
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+#endif
+
if(-1 == HDftruncate(file->fd, (off_t)new_eof))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
} /* end if */
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index f82a97e..ac669d6 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -888,7 +888,7 @@ HDfprintf(stderr, "%s: file->eof = %a, file->eoa = %a\n", FUNC, file->eof, file-
#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)
+ if(-1 == HDlseek(file->fd, (file_offset_t)0, SEEK_SET))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
#endif