summaryrefslogtreecommitdiff
path: root/src/os_windows/os_truncate.c
diff options
context:
space:
mode:
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);