summaryrefslogtreecommitdiff
path: root/src/os_posix/os_ftruncate.c
blob: 6c98aecd852179bb0875b5791b884116ef763a56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*-
 * Copyright (c) 2008-2012 WiredTiger, Inc.
 *	All rights reserved.
 *
 * See the file LICENSE for redistribution information.
 */

#include "wt_internal.h"

/*
 * __wt_ftruncate --
 *	Truncate a file.
 */
int
__wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, off_t len)
{
	int ret;

	WT_SYSCALL_RETRY(ftruncate(fh->fd, len), ret);
	if (ret == 0) {
		fh->file_size = len;
		return (0);
	}

	WT_RET_MSG(session, ret, "%s ftruncate error", fh->name);
}