summaryrefslogtreecommitdiff
path: root/src/os_windows/os_truncate.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-02-17 17:25:57 +0000
committer <>2015-03-17 16:26:24 +0000
commit780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch)
tree598f8b9fa431b228d29897e798de4ac0c1d3d970 /src/os_windows/os_truncate.c
parent7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff)
downloadberkeleydb-master.tar.gz
Imported from /home/lorry/working-area/delta_berkeleydb/db-6.1.23.tar.gz.HEADdb-6.1.23master
Diffstat (limited to 'src/os_windows/os_truncate.c')
-rw-r--r--src/os_windows/os_truncate.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/os_windows/os_truncate.c b/src/os_windows/os_truncate.c
index fcbb37b2..d1150c85 100644
--- a/src/os_windows/os_truncate.c
+++ b/src/os_windows/os_truncate.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2004, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -15,11 +15,12 @@
* Truncate the file.
*/
int
-__os_truncate(env, fhp, pgno, pgsize)
+__os_truncate(env, fhp, pgno, pgsize, relative)
ENV *env;
DB_FH *fhp;
db_pgno_t pgno;
u_int32_t pgsize;
+ off_t relative;
{
/* Yes, this really is how Microsoft have designed their API */
union {
@@ -34,7 +35,7 @@ __os_truncate(env, fhp, pgno, pgsize)
int ret;
dbenv = env == NULL ? NULL : env->dbenv;
- offset = (off_t)pgsize * pgno;
+ offset = (off_t)pgsize * pgno + relative;
ret = 0;
if (dbenv != NULL &&
@@ -84,7 +85,7 @@ __os_truncate(env, fhp, pgno, pgsize)
* We can't switch to SetFilePointerEx, which knows about 64-bit
* offsets, because it isn't supported on Win9x/ME.
*/
- RETRY_CHK((off.bigint = (__int64)pgsize * pgno,
+ RETRY_CHK((off.bigint = (__int64)pgsize * pgno + relative,
(SetFilePointer(fhp->trunc_handle, off.low, &off.high, FILE_BEGIN)
== INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) ||
!SetEndOfFile(fhp->trunc_handle)), ret);