From fa5391a919cf729134d9ec0368fced9cc028d02e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 24 Jan 2008 19:06:25 +0100 Subject: Return NOTFOUND from db_tdb_delete if the record does not exist (This used to be commit 1ff924c4360952eb1d714a2f2ec3760b380c7a24) --- source3/lib/dbwrap_tdb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c index 18f9495931..da55049e52 100644 --- a/source3/lib/dbwrap_tdb.c +++ b/source3/lib/dbwrap_tdb.c @@ -196,8 +196,15 @@ static NTSTATUS db_tdb_delete(struct db_record *rec) struct db_tdb_ctx *ctx = talloc_get_type_abort(rec->private_data, struct db_tdb_ctx); - return (tdb_delete(ctx->wtdb->tdb, rec->key) == 0) ? - NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; + if (tdb_delete(ctx->wtdb->tdb, rec->key) == 0) { + return NT_STATUS_OK; + } + + if (tdb_error(ctx->wtdb->tdb) == TDB_ERR_NOEXIST) { + return NT_STATUS_NOT_FOUND; + } + + return NT_STATUS_UNSUCCESSFUL; } struct db_tdb_traverse_ctx { -- cgit