diff options
author | Volker Lendecke <vl@samba.org> | 2015-09-20 16:26:06 +0200 |
---|---|---|
committer | Ralph Böhme <slow@samba.org> | 2015-09-22 04:51:16 +0200 |
commit | 9964d60e3e3a779bc2a6e72f4d677a72c59e09e4 (patch) | |
tree | 9f38d01a7673bd10ebad28729fc92b908a69eab8 /lib/dbwrap/dbwrap_tdb.c | |
parent | 71a407edad9f3fc1cd1719d87123862698f12f2f (diff) | |
download | samba-9964d60e3e3a779bc2a6e72f4d677a72c59e09e4.tar.gz |
dbwrap: Make dbwrap_db_id return size_t
This will make an on-stack db-id easier
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'lib/dbwrap/dbwrap_tdb.c')
-rw-r--r-- | lib/dbwrap/dbwrap_tdb.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c index a144ed47bb6..0e5444918fa 100644 --- a/lib/dbwrap/dbwrap_tdb.c +++ b/lib/dbwrap/dbwrap_tdb.c @@ -388,12 +388,16 @@ static int db_tdb_transaction_cancel(struct db_context *db) return 0; } -static void db_tdb_id(struct db_context *db, const uint8_t **id, size_t *idlen) +static size_t db_tdb_id(struct db_context *db, uint8_t *id, size_t idlen) { struct db_tdb_ctx *db_ctx = talloc_get_type_abort(db->private_data, struct db_tdb_ctx); - *id = (uint8_t *)&db_ctx->id; - *idlen = sizeof(db_ctx->id); + + if (idlen >= sizeof(db_ctx->id)) { + memcpy(id, &db_ctx->id, sizeof(db_ctx->id)); + } + + return sizeof(db_ctx->id); } struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, |