tdb2: fix error handling for tdb1_transaction_commit.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 2 Sep 2011 06:18:17 +0000 (15:48 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 2 Sep 2011 06:18:17 +0000 (15:48 +0930)
tdb_repack() returns an enum TDB_ERROR, whereas
tdb1_transaction_commit is expected to return 0 or -1.

ccan/tdb2/tdb1_transaction.c

index 6e39de33f4c95269d818b0d8150f68b2735b6c2b..157642a6322bacb1314624a78901a6e27a9d9e6e 100644 (file)
@@ -1174,7 +1174,8 @@ int tdb1_transaction_commit(struct tdb_context *tdb)
        _tdb1_transaction_cancel(tdb);
 
        if (need_repack) {
-               return tdb_repack(tdb);
+               if (tdb_repack(tdb) != 0)
+                       return -1;
        }
 
        return 0;