1 /*-
2  * Copyright (c) 1997, 2020 Oracle and/or its affiliates.  All rights reserved.
3  *
4  * See the file LICENSE for license information.
5  *
6  * $Id$
7  */
8 
9 #include "db_config.h"
10 
11 #include "db_int.h"
12 
13 /*
14  * __os_rmdir --
15  *	Remove a directory.
16  */
17 int
__os_rmdir(env,name)18 __os_rmdir(env, name)
19 	ENV *env;
20 	const char *name;
21 {
22 	DB_ENV *dbenv;
23 	_TCHAR *tname;
24 	int ret;
25 
26 	dbenv = env == NULL ? NULL : env->dbenv;
27 
28 	if (dbenv != NULL &&
29 	    FLD_ISSET(dbenv->verbose, DB_VERB_FILEOPS | DB_VERB_FILEOPS_ALL))
30 		__db_msg(env, DB_STR_A("0239", "fileops: rmdir %s",
31 		    "%s"), name);
32 
33 	TO_TSTRING(env, name, tname, ret);
34 	if (ret != 0)
35 		return (ret);
36 	RETRY_CHK(!RemoveDirectory(tname), ret);
37 	FREE_STRING(env, tname);
38 	if (ret != 0)
39 		return (__os_posix_err(ret));
40 
41 	return (ret);
42 }
43