blob: 644a27dca9a024db58d63cc895b93cd1c1e48c94 (
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
38
|
/*-
* Copyright (c) 2014-2015 MongoDB, Inc.
* Copyright (c) 2008-2014 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 *filename, bool *existp)
{
struct stat sb;
WT_DECL_RET;
char *path;
*existp = false;
WT_RET(__wt_filename(session, filename, &path));
WT_SYSCALL_RETRY(stat(path, &sb), ret);
__wt_free(session, path);
if (ret == 0) {
*existp = true;
return (0);
}
if (ret == ENOENT)
return (0);
WT_RET_MSG(session, ret, "%s: fstat", filename);
}
|