diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/dbwrap_util.c | 13 |
1 files changed, 7 insertions, 6 deletions
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 { |