summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:07:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:07:13 +0930
commit9b9aa556defbf35f782109464e4295d250e59f24 (patch)
tree46d40c77d2824f61fa737d9cc232ffb1e65d4e9c /lib
parente8eebe0fbc3c3c946380a1c554bc1214ae899663 (diff)
downloadsamba-9b9aa556defbf35f782109464e4295d250e59f24.tar.gz
samba-9b9aa556defbf35f782109464e4295d250e59f24.tar.bz2
samba-9b9aa556defbf35f782109464e4295d250e59f24.zip
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. (Imported from CCAN commit 51f592dfcda4d58d6b9d8134b6e1aff791dc40f2) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib')
-rw-r--r--lib/tdb2/open.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/tdb2/open.c b/lib/tdb2/open.c
index 63076ec77f..43a9a2b40e 100644
--- a/lib/tdb2/open.c
+++ b/lib/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;
}