diff options
author | Volker Lendecke <vl@samba.org> | 2012-12-14 15:53:08 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-12-21 11:57:01 +0100 |
commit | 3109b541c9b2f0063e1ccb0cdaec0a8e388b29b4 (patch) | |
tree | 8ff6c508265e04586a0138b78f122f08867c04ec /lib/tdb | |
parent | d972e6fa74b6499403d4c3d3c6a84cbda7eded39 (diff) | |
download | samba-3109b541c9b2f0063e1ccb0cdaec0a8e388b29b4.tar.gz |
tdb: Make tdb_new_database() follow a more conventional style
We usually "goto fail" on every error and then in normal flow set the
return variable to success. This patch removes a comment which from my
point of view is now obsolete. It violates the {} rule from README.Coding
here in favor of the style used in this function.
Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/tdb')
-rw-r--r-- | lib/tdb/common/open.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c index 694701f69dc..b10f5ebe974 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; |