summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/lib/dbwrap_util.c13
2 files changed, 9 insertions, 8 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ebeb5658f2..6d9c35beb0 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -442,8 +442,8 @@ bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
uint32_t *oldval, uint32_t change_val);
-int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
- int32 *oldval, int32 change_val);
+NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
+ int32 *oldval, int32 change_val);
NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
int flag);
NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key);
diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c
index 5e02d47290..549fd46624 100644
--- a/source3/lib/dbwrap_util.c
+++ b/source3/lib/dbwrap_util.c
@@ -147,16 +147,17 @@ NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
* return old value in *oldval.
* store *oldval + change_val to db.
*/
-int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
- int32 *oldval, int32 change_val)
+NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
+ int32 *oldval, int32 change_val)
{
struct db_record *rec;
int32 val = -1;
TDB_DATA data;
+ NTSTATUS ret;
if (!(rec = db->fetch_locked(db, NULL,
string_term_tdb_data(keystr)))) {
- return -1;
+ return NT_STATUS_UNSUCCESSFUL;
}
if (rec->value.dptr == NULL) {
@@ -165,7 +166,7 @@ int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
val = IVAL(rec->value.dptr, 0);
*oldval = val;
} else {
- return -1;
+ return NT_STATUS_UNSUCCESSFUL;
}
val += change_val;
@@ -173,11 +174,11 @@ int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
data.dsize = sizeof(val);
data.dptr = (uint8 *)&val;
- rec->store(rec, data, TDB_REPLACE);
+ ret = rec->store(rec, data, TDB_REPLACE);
TALLOC_FREE(rec);
- return 0;
+ return ret;
}
struct dbwrap_store_context {