summaryrefslogtreecommitdiff
path: root/source3/tdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1999-12-22 01:31:09 +0000
committerAndrew Tridgell <tridge@samba.org>1999-12-22 01:31:09 +0000
commitecfee3f1708d3335e4bd4a9abb0eb59979ba2523 (patch)
tree220de2cadbd0f288318c5ddde000f5474bb674df /source3/tdb
parente7851ce52e408db4d78a45066ed042708203e7a1 (diff)
downloadsamba-ecfee3f1708d3335e4bd4a9abb0eb59979ba2523.tar.gz
samba-ecfee3f1708d3335e4bd4a9abb0eb59979ba2523.tar.bz2
samba-ecfee3f1708d3335e4bd4a9abb0eb59979ba2523.zip
fixed a bug in the handling of tdb version number upgrade
(This used to be commit ed7541668e9bc98ae9daf55f817d2de04345e660)
Diffstat (limited to 'source3/tdb')
-rw-r--r--source3/tdb/tdb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index ff56ffaf2b..b57945c8e1 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -385,6 +385,9 @@ static int tdb_new_database(TDB_CONTEXT *tdb, int hash_size)
/* create the header */
header.version = TDB_VERSION;
header.hash_size = hash_size;
+ lseek(tdb->fd, 0, SEEK_SET);
+ ftruncate(tdb->fd, 0);
+
if (write(tdb->fd, &header, sizeof(header)) != sizeof(header)) return -1;
/* the freelist and hash pointers */