}
struct db_context *db_open_watched(TALLOC_CTX *mem_ctx,
- struct db_context *backend,
+ struct db_context **backend,
struct messaging_context *msg)
{
struct db_context *db;
ctx->msg = msg;
- db->lock_order = backend->lock_order;
- backend->lock_order = DBWRAP_LOCK_ORDER_NONE;
- ctx->backend = talloc_move(ctx, &backend);
+ ctx->backend = talloc_move(ctx, backend);
+ db->lock_order = ctx->backend->lock_order;
+ ctx->backend->lock_order = DBWRAP_LOCK_ORDER_NONE;
db->fetch_locked = dbwrap_watched_fetch_locked;
db->do_locked = dbwrap_watched_do_locked;
#include "messages.h"
struct db_context *db_open_watched(TALLOC_CTX *mem_ctx,
- struct db_context *backend,
+ struct db_context **backend,
struct messaging_context *msg);
struct tevent_req *dbwrap_watched_watch_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
return NULL;
}
- result->db = db_open_watched(result, backend, msg);
+ result->db = db_open_watched(result, &backend, msg);
if (result->db == NULL) {
DBG_WARNING("db_open_watched failed\n");
TALLOC_FREE(result);
return False;
}
- lock_db = db_open_watched(NULL, backend, server_messaging_context());
+ lock_db = db_open_watched(NULL, &backend, server_messaging_context());
if (lock_db == NULL) {
DBG_ERR("db_open_watched failed\n");
TALLOC_FREE(backend);
return status;
}
- db_ctx = db_open_watched(NULL, backend, server_messaging_context());
+ db_ctx = db_open_watched(NULL, &backend, server_messaging_context());
if (db_ctx == NULL) {
TALLOC_FREE(backend);
return NT_STATUS_NO_MEMORY;
return false;
}
- db = db_open_watched(talloc_tos(), backend, msg);
+ db = db_open_watched(talloc_tos(), &backend, msg);
if (db == NULL) {
fprintf(stderr, "db_open_watched failed: %s\n",
strerror(errno));
goto fail;
}
- db = db_open_watched(ev, backend, msg);
+ db = db_open_watched(ev, &backend, msg);
rec = dbwrap_fetch_locked(db, db, key);
if (rec == NULL) {
goto fail;
}
- db = db_open_watched(ev, backend, msg);
+ db = db_open_watched(ev, &backend, msg);
if (db == NULL) {
fprintf(stderr, "db_open_watched failed\n");
goto fail;