s3:dbwrap_tdb: correctly catch the error from the return code of tdb_parse in db_tdb_...
authorMichael Adam <obnox@samba.org>
Thu, 25 Aug 2011 11:45:40 +0000 (13:45 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 25 Aug 2011 21:55:06 +0000 (23:55 +0200)
source3/lib/dbwrap/dbwrap_tdb.c

index aca57b63ce7cc038b403da1736a762026b89c397..f3528a98c1a3dd35aaf5495e63e6e27ffe890596 100644 (file)
@@ -160,12 +160,17 @@ static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
                db->private_data, struct db_tdb_ctx);
 
        struct tdb_fetch_state state;
+       int ret;
 
        state.mem_ctx = mem_ctx;
        state.result = 0;
        state.data = tdb_null;
 
-       tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state);
+       ret = tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state);
+
+       if (ret < 0) {
+               return -1;
+       }
 
        if (state.result == -1) {
                return -1;