]> git.ozlabs.org Git - ccan/commitdiff
tdb2: don't return -1 (ie. TDB_ERR_CORRUPT) on transaction write fail.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 2 Sep 2011 06:13:20 +0000 (15:43 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 2 Sep 2011 06:13:20 +0000 (15:43 +0930)
A left-over -1 return; should be returning ecode (probably TDB_ERR_IO).

ccan/tdb2/transaction.c

index 64bd5366ebeb03d72d58c4f3121d18e61b1cf2fe..1f5709bf437468ccb082085de0747952ee931149 100644 (file)
@@ -203,7 +203,7 @@ static enum TDB_ERROR transaction_write(struct tdb_context *tdb, tdb_off_t off,
                tdb_len_t len2 = PAGESIZE - (off % PAGESIZE);
                ecode = transaction_write(tdb, off, buf, len2);
                if (ecode != TDB_SUCCESS) {
                tdb_len_t len2 = PAGESIZE - (off % PAGESIZE);
                ecode = transaction_write(tdb, off, buf, len2);
                if (ecode != TDB_SUCCESS) {
-                       return -1;
+                       return ecode;
                }
                len -= len2;
                off += len2;
                }
                len -= len2;
                off += len2;