Imported Upstream version 5.3.21
[platform/upstream/libdb.git] / src / os_windows / os_mkdir.c
1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 1997, 2012 Oracle and/or its affiliates.  All rights reserved.
5  *
6  * $Id$
7  */
8
9 #include "db_config.h"
10
11 #include "db_int.h"
12
13 /*
14  * __os_mkdir --
15  *      Create a directory.
16  */
17 int
18 __os_mkdir(env, name, mode)
19         ENV *env;
20         const char *name;
21         int mode;
22 {
23         DB_ENV *dbenv;
24         _TCHAR *tname;
25         int ret;
26
27         dbenv = env == NULL ? NULL : env->dbenv;
28
29         if (dbenv != NULL &&
30             FLD_ISSET(dbenv->verbose, DB_VERB_FILEOPS | DB_VERB_FILEOPS_ALL))
31                 __db_msg(env, DB_STR_A("0013", "fileops: mkdir %s",
32                     "%s"), name);
33
34         /* Make the directory, with paranoid permissions. */
35         TO_TSTRING(env, name, tname, ret);
36         if (ret != 0)
37                 return (ret);
38         RETRY_CHK(!CreateDirectory(tname, NULL), ret);
39         FREE_STRING(env, tname);
40         if (ret != 0)
41                 return (__os_posix_err(ret));
42
43         return (ret);
44 }