diff options
author | Amitay Isaacs <amitay@gmail.com> | 2016-10-12 15:41:25 +1100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-10-27 23:53:13 +0200 |
commit | e42648f977d944e3b33347a2adb109e0d89c91d4 (patch) | |
tree | 3a64eb9f87a50ca727ce09e82d063eaf6106ea64 /ctdb/tools | |
parent | c09567fe59feb701e523425f6cdaf1736b2795fa (diff) | |
download | samba-e42648f977d944e3b33347a2adb109e0d89c91d4.tar.gz |
ctdb-tools: Simplify using tdb_storev
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tools')
-rw-r--r-- | ctdb/tools/ltdbtool.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ctdb/tools/ltdbtool.c b/ctdb/tools/ltdbtool.c index 23520796589..e30309056f7 100644 --- a/ctdb/tools/ltdbtool.c +++ b/ctdb/tools/ltdbtool.c @@ -332,18 +332,18 @@ static int write_record(TDB_CONTEXT* tdb, TDB_DATA key, TDB_DATA val, return -1; } } else { - TDB_DATA h = { - .dptr = (void*)hdr, - .dsize = ctx->hsize, - }; - if(tdb_store(ctx->tdb, key, h, ctx->tdb_store_flags) == -1) { + TDB_DATA rec[2]; + + rec[0].dsize = ctx->hsize; + rec[0].dptr = (uint8_t *)hdr; + + rec[1].dsize = val.dsize; + rec[1].dptr = val.dptr; + + if(tdb_storev(ctx->tdb, key, rec, 2, ctx->tdb_store_flags) == -1) { fprintf(stderr, "tdb_store: %s\n", tdb_errorstr(ctx->tdb)); return -1; } - if(tdb_append(ctx->tdb, key, val) == -1) { - fprintf(stderr, "tdb_append: %s\n", tdb_errorstr(ctx->tdb)); - return -1; - } } return 0; } |