1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

dbwrap: Convert dbwrap_delete to dbwrap_do_locked

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2016-11-09 16:37:49 +01:00 committed by Jeremy Allison
parent 5095733f92
commit a11450d825

View File

@ -327,20 +327,27 @@ NTSTATUS dbwrap_store(struct db_context *db, TDB_DATA key,
return state.status;
}
struct dbwrap_delete_state {
NTSTATUS status;
};
static void dbwrap_delete_fn(struct db_record *rec, void *private_data)
{
struct dbwrap_delete_state *state = private_data;
state->status = dbwrap_record_delete(rec);
}
NTSTATUS dbwrap_delete(struct db_context *db, TDB_DATA key)
{
struct db_record *rec;
struct dbwrap_delete_state state;
NTSTATUS status;
TALLOC_CTX *frame = talloc_stackframe();
rec = dbwrap_fetch_locked(db, frame, key);
if (rec == NULL) {
TALLOC_FREE(frame);
return NT_STATUS_NO_MEMORY;
status = dbwrap_do_locked(db, key, dbwrap_delete_fn, &state);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
status = dbwrap_record_delete(rec);
TALLOC_FREE(frame);
return status;
return state.status;
}
NTSTATUS dbwrap_traverse(struct db_context *db,