diff options
author | Michael Adam <obnox@samba.org> | 2009-12-11 12:30:57 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2010-04-01 09:39:14 +0200 |
commit | a3726f340eb211dfbac3929ad36496de2ac836dc (patch) | |
tree | f6496c23b7c9680dd89a6a88658743b4bde8aa3c /source3/lib | |
parent | 8f0bb64c2cf698439ec7f0cb859f55f0d8158a4f (diff) | |
download | samba-a3726f340eb211dfbac3929ad36496de2ac836dc.tar.gz |
s3:dbwrap_ctdb: change db_ctdb_transaction_store() to return NTSTATUS.
The return values calculated by the callers were wrong anyways since
the new marshalling code does not set the local tdbs tdb error code.
Michael
(cherry picked from commit 26225d3e798892b39b3c238b0bee465bffac6550)
(cherry picked from commit 06943fe1e6982c9df4886ee0a17572e502726897)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/dbwrap_ctdb.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c index 63b63fa4ff8..0986083268f 100644 --- a/source3/lib/dbwrap_ctdb.c +++ b/source3/lib/dbwrap_ctdb.c @@ -577,8 +577,8 @@ static struct db_record *db_ctdb_fetch_locked_persistent(struct db_ctdb_ctx *ctx /* stores a record inside a transaction */ -static int db_ctdb_transaction_store(struct db_ctdb_transaction_handle *h, - TDB_DATA key, TDB_DATA data) +static NTSTATUS db_ctdb_transaction_store(struct db_ctdb_transaction_handle *h, + TDB_DATA key, TDB_DATA data) { TALLOC_CTX *tmp_ctx = talloc_new(h); TDB_DATA rec; @@ -608,7 +608,7 @@ static int db_ctdb_transaction_store(struct db_ctdb_transaction_handle *h, data.dsize) == 0) { SAFE_FREE(rec.dptr); talloc_free(tmp_ctx); - return 0; + return NT_STATUS_OK; } } SAFE_FREE(rec.dptr); @@ -623,18 +623,18 @@ static int db_ctdb_transaction_store(struct db_ctdb_transaction_handle *h, DEBUG(0,(__location__ " Failed to add to marshalling " "record\n")); talloc_free(tmp_ctx); - return -1; + return NT_STATUS_NO_MEMORY; } h->m_write = db_ctdb_marshall_add(h, h->m_write, h->ctx->db_id, 0, key, &header, data); if (h->m_write == NULL) { DEBUG(0,(__location__ " Failed to add to marshalling record\n")); talloc_free(tmp_ctx); - return -1; + return NT_STATUS_NO_MEMORY; } talloc_free(tmp_ctx); - return 0; + return NT_STATUS_OK; } @@ -645,13 +645,10 @@ static NTSTATUS db_ctdb_store_transaction(struct db_record *rec, TDB_DATA data, { struct db_ctdb_transaction_handle *h = talloc_get_type_abort( rec->private_data, struct db_ctdb_transaction_handle); - int ret; + NTSTATUS status; - ret = db_ctdb_transaction_store(h, rec->key, data); - if (ret != 0) { - return tdb_error_to_ntstatus(h->ctx->wtdb->tdb); - } - return NT_STATUS_OK; + status = db_ctdb_transaction_store(h, rec->key, data); + return status; } /* @@ -661,13 +658,10 @@ static NTSTATUS db_ctdb_delete_transaction(struct db_record *rec) { struct db_ctdb_transaction_handle *h = talloc_get_type_abort( rec->private_data, struct db_ctdb_transaction_handle); - int ret; + NTSTATUS status; - ret = db_ctdb_transaction_store(h, rec->key, tdb_null); - if (ret != 0) { - return tdb_error_to_ntstatus(h->ctx->wtdb->tdb); - } - return NT_STATUS_OK; + status = db_ctdb_transaction_store(h, rec->key, tdb_null); + return status; } /* |