summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-07-29 14:21:03 +0200
committerMichael Adam <obnox@samba.org>2009-07-29 16:26:21 +0200
commitaa4e5a32a7ee3e71fc0b69ad7e8bd44b57c9273d (patch)
tree8711bb89200379936e511cc19e9432601d911032 /source3
parentded0ce8345b99e9d5e0cfaea7cee58648baea4b7 (diff)
downloadsamba-aa4e5a32a7ee3e71fc0b69ad7e8bd44b57c9273d.tar.gz
samba-aa4e5a32a7ee3e71fc0b69ad7e8bd44b57c9273d.tar.bz2
samba-aa4e5a32a7ee3e71fc0b69ad7e8bd44b57c9273d.zip
s3:dbwrap: change dbwrap_change_int32_atomic() to return NTSTATUS not int32.
Michael
Diffstat (limited to 'source3')
-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 {