summaryrefslogtreecommitdiff
path: root/lib/dbwrap
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dbwrap')
-rw-r--r--lib/dbwrap/dbwrap_util.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/dbwrap/dbwrap_util.c b/lib/dbwrap/dbwrap_util.c
index 22f910de992..443a915df2d 100644
--- a/lib/dbwrap/dbwrap_util.c
+++ b/lib/dbwrap/dbwrap_util.c
@@ -77,23 +77,14 @@ NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr,
NTSTATUS dbwrap_store_int32_bystring(struct db_context *db, const char *keystr,
int32_t v)
{
- struct db_record *rec;
- int32_t v_store;
+ uint8_t v_store[sizeof(int32_t)];
+ TDB_DATA data = { .dptr = v_store, .dsize = sizeof(v_store) };
NTSTATUS status;
- rec = dbwrap_fetch_locked(db, talloc_tos(),
- string_term_tdb_data(keystr));
- if (rec == NULL) {
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- SIVAL(&v_store, 0, v);
+ SIVAL(v_store, 0, v);
- status = dbwrap_record_store(rec,
- make_tdb_data((const uint8_t *)&v_store,
- sizeof(v_store)),
- TDB_REPLACE);
- TALLOC_FREE(rec);
+ status = dbwrap_store(db, string_term_tdb_data(keystr), data,
+ TDB_REPLACE);
return status;
}