From 51f592dfcda4d58d6b9d8134b6e1aff791dc40f2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 31 Aug 2011 10:41:12 +0930 Subject: [PATCH] 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. --- ccan/tdb2/open.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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; } -- 2.39.2