Commit 7396991d authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

refs #5101 made new home looks like ancient windows code. dead.


git-svn-id: file:///svn/toku/tokudb@48098 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1e1f59f7
...@@ -777,36 +777,18 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) { ...@@ -777,36 +777,18 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
if (!home) home = "."; if (!home) home = ".";
// Verify that the home exists. // Verify that the home exists.
{ toku_struct_stat buf;
bool made_new_home = false; r = toku_stat(home, &buf);
char* new_home = NULL; if (r != 0) {
toku_struct_stat buf; int e = get_error_errno();
if (strlen(home) > 1 && home[strlen(home)-1] == '\\') { r = toku_ydb_do_error(env, e, "Error from toku_stat(\"%s\",...)\n", home);
// This chops the last character ('\') off of home. The goto cleanup;
// fencepost error is (seems?) intentional.
XMALLOC_N(strlen(home), new_home);
memcpy(new_home, home, strlen(home));
new_home[strlen(home) - 1] = 0;
made_new_home = true;
}
r = toku_stat(made_new_home? new_home : home, &buf);
int er;
if (r!=0) {
er = get_error_errno();
r = toku_ydb_do_error(env, er, "Error from toku_stat(\"%s\",...)\n", home);
if (made_new_home) {
toku_free(new_home);
}
goto cleanup;
}
if (made_new_home) {
toku_free(new_home);
}
} }
unused_flags &= ~DB_PRIVATE; unused_flags &= ~DB_PRIVATE;
if (env->i->dir) if (env->i->dir) {
toku_free(env->i->dir); toku_free(env->i->dir);
}
env->i->dir = toku_strdup(home); env->i->dir = toku_strdup(home);
if (env->i->dir == 0) { if (env->i->dir == 0) {
r = toku_ydb_do_error(env, ENOMEM, "Out of memory\n"); r = toku_ydb_do_error(env, ENOMEM, "Out of memory\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment