X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Fopen.c;h=daa83a334c44a39db4dad37c77e0090fee858769;hb=51f592dfcda4d58d6b9d8134b6e1aff791dc40f2;hp=def816775c76efa8cd80db786084926c6e04e5d8;hpb=de868b8eee34e39b4465dd9def9141b97926e847;p=ccan
diff --git a/ccan/tdb2/open.c b/ccan/tdb2/open.c
index def81677..daa83a33 100644
--- a/ccan/tdb2/open.c
+++ b/ccan/tdb2/open.c
@@ -1,3 +1,20 @@
+ /*
+ Trivial Database 2: opening and closing TDBs
+ Copyright (C) Rusty Russell 2010
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see .
+*/
#include "private.h"
#include
#include
@@ -533,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;
}