tdb: fix short write logic in tdb_new_database
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 16 Aug 2010 00:50:19 +0000 (10:20 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 16 Aug 2010 00:50:19 +0000 (10:20 +0930)
commit27ba0e5a6681063225df7244a85aa304c51c6948
treef7a0081a233af53d524618c68e869479ef7ff319
parenteededd592c92c59b435f0046989b2327fcc280b1
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