blob: 04c395223ffc2edecf6342fc5948eabbc964b214 (
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
27
28
29
30
31
32
33
34
35
36
37
|
/*-
* Copyright (c) 2008-2012 WiredTiger, Inc.
* All rights reserved.
*
* See the file LICENSE for redistribution information.
*/
#include "wt_internal.h"
/*
* __wt_exist --
* Return if the file exists.
*/
int
__wt_exist(WT_SESSION_IMPL *session, const char *name, int *existp)
{
const char *path;
struct stat sb;
int ret;
WT_RET(__wt_filename(session, name, &path));
WT_SYSCALL_RETRY(stat(path, &sb), ret);
__wt_free(session, path);
if (ret == 0) {
*existp = 1;
return (0);
}
if (ret == ENOENT) {
*existp = 0;
return (0);
}
WT_RET_MSG(session, ret, "%s: fstat", name);
}
|