From: Rusty Russell Date: Wed, 31 Aug 2011 01:11:12 +0000 (+0930) Subject: tdb2: fix internal tdb_write_convert() error handling in tdb_open() X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=51f592dfcda4d58d6b9d8134b6e1aff791dc40f2;p=ccan tdb2: fix internal tdb_write_convert() error handling in tdb_open() As noted, failtest was taking a long time, because a failure injected here was not detected. --- diff --git a/ccan/tdb2/open.c b/ccan/tdb2/open.c index e88c9e69..daa83a33 100644 --- a/ccan/tdb2/open.c +++ b/ccan/tdb2/open.c @@ -550,10 +550,11 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags, /* Clear any features we don't understand. */ if ((open_flags & O_ACCMODE) != O_RDONLY) { hdr.features_used &= TDB_FEATURE_MASK; - if (tdb_write_convert(tdb, offsetof(struct tdb_header, - features_used), - &hdr.features_used, - sizeof(hdr.features_used)) == -1) + ecode = tdb_write_convert(tdb, offsetof(struct tdb_header, + features_used), + &hdr.features_used, + sizeof(hdr.features_used)); + if (ecode != TDB_SUCCESS) goto fail; }