summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-07-29 14:16:11 +0200
committerMichael Adam <obnox@samba.org>2009-07-29 16:26:21 +0200
commitded0ce8345b99e9d5e0cfaea7cee58648baea4b7 (patch)
treedb3b9a8af509bef9f3e68ab433be9a7971beae50 /source3/lib
parentd916e56c4c9dc729dc88418f75ebbbf943597476 (diff)
downloadsamba-ded0ce8345b99e9d5e0cfaea7cee58648baea4b7.tar.gz
samba-ded0ce8345b99e9d5e0cfaea7cee58648baea4b7.tar.bz2
samba-ded0ce8345b99e9d5e0cfaea7cee58648baea4b7.zip
s3:dbwrap: change dbwrap_change_uint32_atomic() to return NTSTATUS not uint32_t.
Michael
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/dbwrap_util.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c
index c3ab93c4df..5e02d47290 100644
--- a/source3/lib/dbwrap_util.c
+++ b/source3/lib/dbwrap_util.c
@@ -106,16 +106,17 @@ int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v)
* return old value in *oldval.
* store *oldval + change_val to db.
*/
-uint32_t dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
+NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
uint32_t *oldval, uint32_t change_val)
{
struct db_record *rec;
uint32 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) {
@@ -124,7 +125,7 @@ uint32_t dbwrap_change_uint32_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;
@@ -132,11 +133,11 @@ uint32_t dbwrap_change_uint32_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;
}
/**