tdb2: don't continue if tdb1_find fails.
commit1cb92ea9cf3efcc5f4295b7aeb8ddd10e174127c
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Sep 2011 22:43:26 +0000 (14 08:13 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Sep 2011 22:43:26 +0000 (14 08:13 +0930)
tree01c94f07d81359ecc1d452864bfcbc8ab4d2908a
parent01b2214a1893db5071addf1fdf17e9ac06ed63a0
tdb2: don't continue if tdb1_find fails.

The TDB1 code's tdb1_find() returns 0 on error; the callers should
not assume that the error means that the entry wasn't found, but use
last_error to determine it.

This was found by looking at how long the failure path testing for
test/run-10-simple-store.c was taking under valgrind, ie:

valgrind -q ./run-10-simple-store --show-slowest

This change dropped the time for that test from 53 seconds to 19
seconds.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 1be090a2d749713cfd0c4584cafb97bffd716189)
lib/tdb2/tdb1_tdb.c