diff options
-rw-r--r-- | source3/tdb/tdbtool.c | 8 | ||||
-rw-r--r-- | source3/tdb/tdbtorture.c | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/source3/tdb/tdbtool.c b/source3/tdb/tdbtool.c index 76b6259ef8..317ad9b4fc 100644 --- a/source3/tdb/tdbtool.c +++ b/source3/tdb/tdbtool.c @@ -170,6 +170,12 @@ static char *getline(char *prompt) return p?line:NULL; } +static int do_delete_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, + void *state) +{ + return tdb_delete(tdb, key); +} + int main(int argc, char *argv[]) { char *line; @@ -199,7 +205,7 @@ int main(int argc, char *argv[]) } else if (strcmp(tok,"show") == 0) { show_tdb(); } else if (strcmp(tok,"erase") == 0) { - tdb_traverse(tdb, tdb_delete, NULL); + tdb_traverse(tdb, do_delete_fn, NULL); } else if (strcmp(tok,"delete") == 0) { delete_tdb(); } else if (strcmp(tok,"dump") == 0) { diff --git a/source3/tdb/tdbtorture.c b/source3/tdb/tdbtorture.c index d72d7b3525..159b47f369 100644 --- a/source3/tdb/tdbtorture.c +++ b/source3/tdb/tdbtorture.c @@ -74,7 +74,8 @@ static void addrec_db(void) free(d); } -static int traverse_fn(TDB_CONTEXT *db, TDB_DATA key, TDB_DATA dbuf) +static int traverse_fn(TDB_CONTEXT *db, TDB_DATA key, TDB_DATA dbuf, + void *state) { tdb_delete(db, key); return 0; @@ -97,7 +98,7 @@ int main(int argc, char *argv[]) if (fork() == 0) break; } - db = tdb_open("test.tdb", 0, TDB_CLEAR_IF_FIRST, + db = tdb_open(NULL, 0, TDB_CLEAR_IF_FIRST, O_RDWR | O_CREAT, 0600); if (!db) { fatal("db open failed"); |