tdb: fix short write logic in tdb_new_database
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 5 May 2010 06:07:18 +0000 (15:37 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 5 May 2010 06:07:18 +0000 (15:37 +0930)
commit91e4a1760dee22e9a40ca52f1e5a1b549d9e066d
tree879c390a4be016332c981a4392eaa2a5175a3117
parenta9e008ee36c8fd9ca79b3bdfdc78111939c3e539
tdb: fix short write logic in tdb_new_database

Commit 207a213c/24fed55d purported to fix the problem of signals during
tdb_new_database (which could cause a spurious short write, hence a failure).
However, the code is wrong: newdb+written is not correct.

Fix this by introducing a general tdb_write_all() and using it here and in
the tracing code.

Cc: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
lib/tdb/common/open.c
lib/tdb/common/tdb.c
lib/tdb/common/tdb_private.h