diff options
author | Amitay Isaacs <amitay@gmail.com> | 2016-10-12 15:46:17 +1100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-10-27 23:53:13 +0200 |
commit | 2c736f4408c47bdeef9f84da42e4294f5336d69b (patch) | |
tree | 70b546607bfd593df1511ce46820a644ea55f451 /ctdb/tools | |
parent | e42648f977d944e3b33347a2adb109e0d89c91d4 (diff) | |
download | samba-2c736f4408c47bdeef9f84da42e4294f5336d69b.tar.gz |
ctdb-tools: Simplify using a local variable
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tools')
-rw-r--r-- | ctdb/tools/ltdbtool.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/ctdb/tools/ltdbtool.c b/ctdb/tools/ltdbtool.c index e30309056f7..e8465b2659f 100644 --- a/ctdb/tools/ltdbtool.c +++ b/ctdb/tools/ltdbtool.c @@ -325,12 +325,10 @@ static int write_record(TDB_CONTEXT* tdb, TDB_DATA key, TDB_DATA val, { struct write_record_ctx* ctx = (struct write_record_ctx*)write_record_ctx; + int ret; if (ctx->hsize == 0) { - if (tdb_store(ctx->tdb, key, val, ctx->tdb_store_flags) == -1) { - fprintf(stderr, "tdb_store: %s\n", tdb_errorstr(ctx->tdb)); - return -1; - } + ret = tdb_store(ctx->tdb, key, val, ctx->tdb_store_flags); } else { TDB_DATA rec[2]; @@ -340,11 +338,14 @@ static int write_record(TDB_CONTEXT* tdb, TDB_DATA key, TDB_DATA val, 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; - } + ret = tdb_storev(ctx->tdb, key, rec, 2, ctx->tdb_store_flags); + } + + if (ret == -1) { + fprintf(stderr, "tdb_store: %s\n", tdb_errorstr(ctx->tdb)); + return -1; } + return 0; } |