Commit e669f589 authored by Yoni Fogel's avatar Yoni Fogel

DB->remove (with no subdb) now correctly returns

error codes from unlink.
Modified test_db_remove_subdb to check for this.
Closes #211

git-svn-id: file:///svn/tokudb@1288 c7de825b-a66e-492c-adef-691d508d4ae1
parent 605ad57b
......@@ -30,6 +30,12 @@ int main (int argc, char *argv[]) {
// Note: without DB_INIT_MPOOL the BDB library will fail on db->open().
r=env->open(env, DIR, DB_INIT_MPOOL|DB_PRIVATE|DB_CREATE, 0777); assert(r==0);
r=db_create(&db, env, 0); assert(r==0);
r=db->remove(db, "DoesNotExist.db", NULL, 0); assert(r==ENOENT);
r=db_create(&db, env, 0); assert(r==0);
r=db->remove(db, "DoesNotExist.db", "SubDb", 0); assert(r==ENOENT);
r=db_create(&db, env, 0); assert(r==0);
r=db->open(db, NULL, "master.db", "first", DB_BTREE, DB_CREATE, 0666); CKERR(r);
data.size = sizeof("first.db");
......
......@@ -1385,7 +1385,9 @@ static int toku_db_remove(DB * db, const char *fname, const char *dbname, u_int3
return r;
}
r2 = db->close(db, 0);
if (r == 0 && r2 == 0) r = unlink(ffull);
if (r == 0 && r2 == 0) {
if (unlink(ffull) != 0) r = errno;
}
return r ? r : r2;
}
......
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