diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c index 3e91f46b428..45e17958b92 100644 --- a/source3/lib/dbwrap/dbwrap_watch.c +++ b/source3/lib/dbwrap/dbwrap_watch.c @@ -738,7 +738,7 @@ static size_t dbwrap_watched_id(struct db_context *db, uint8_t *id, } 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; @@ -757,9 +757,9 @@ struct db_context *db_open_watched(TALLOC_CTX *mem_ctx, 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; diff --git a/source3/lib/dbwrap/dbwrap_watch.h b/source3/lib/dbwrap/dbwrap_watch.h index e94378f2d5a..a836ca48e8a 100644 --- a/source3/lib/dbwrap/dbwrap_watch.h +++ b/source3/lib/dbwrap/dbwrap_watch.h @@ -25,7 +25,7 @@ #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, diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index 96e5612529d..d8298b6ee33 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -172,7 +172,7 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx, 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); diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 49d4a7c5aec..0bf7b9db90a 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -86,7 +86,7 @@ static bool locking_init_internal(bool read_only) 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); diff --git a/source3/smbd/smbXsrv_session.c b/source3/smbd/smbXsrv_session.c index 557a43f2f8c..af47f4aa8c3 100644 --- a/source3/smbd/smbXsrv_session.c +++ b/source3/smbd/smbXsrv_session.c @@ -89,7 +89,7 @@ NTSTATUS smbXsrv_session_global_init(struct messaging_context *msg_ctx) 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; diff --git a/source3/torture/test_dbwrap_do_locked.c b/source3/torture/test_dbwrap_do_locked.c index 46b326bf163..2e5305d4d75 100644 --- a/source3/torture/test_dbwrap_do_locked.c +++ b/source3/torture/test_dbwrap_do_locked.c @@ -97,7 +97,7 @@ bool run_dbwrap_do_locked1(int dummy) 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)); diff --git a/source3/torture/test_dbwrap_watch.c b/source3/torture/test_dbwrap_watch.c index 97d5ea6393c..5ef6b105ca2 100644 --- a/source3/torture/test_dbwrap_watch.c +++ b/source3/torture/test_dbwrap_watch.c @@ -56,7 +56,7 @@ bool run_dbwrap_watch1(int dummy) 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) { @@ -153,7 +153,7 @@ bool run_dbwrap_watch2(int dummy) 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;