summaryrefslogtreecommitdiff
path: root/lib/tdb/common
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tdb/common')
-rw-r--r--lib/tdb/common/open.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c
index 694701f69d..b10f5ebe97 100644
--- a/lib/tdb/common/open.c
+++ b/lib/tdb/common/open.c
@@ -94,10 +94,11 @@ static int tdb_new_database(struct tdb_context *tdb, int hash_size)
memcpy(&tdb->header, newdb, sizeof(tdb->header));
/* Don't endian-convert the magic food! */
memcpy(newdb->magic_food, TDB_MAGIC_FOOD, strlen(TDB_MAGIC_FOOD)+1);
- /* we still have "ret == -1" here */
- if (tdb_write_all(tdb->fd, newdb, size))
- ret = 0;
+ if (!tdb_write_all(tdb->fd, newdb, size))
+ goto fail;
+
+ ret = 0;
fail:
SAFE_FREE(newdb);
return ret;