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
27
28
29
30
31
32
33
34
|
/*-
* Copyright (c) 2008-2012 WiredTiger, Inc.
* All rights reserved.
*
* See the file LICENSE for redistribution information.
*/
#include "wt_internal.h"
/*
* __wt_rename --
* Rename a file.
*/
int
__wt_rename(WT_SESSION_IMPL *session, const char *from, const char *to)
{
int ret;
const char *from_path, *to_path;
WT_VERBOSE(session, fileops, "rename %s to %s", from, to);
WT_RET(__wt_filename(session, from, &from_path));
WT_RET(__wt_filename(session, to, &to_path));
WT_SYSCALL_RETRY(rename(from_path, to_path), ret);
__wt_free(session, from_path);
__wt_free(session, to_path);
if (ret == 0)
return (0);
WT_RET_MSG(session, ret, "rename %s to %s", from, to);
}
|