diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-05-10 12:58:20 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-05-10 12:58:20 +0000 |
commit | b3d4c0c9f56bd654ba92f3967eb4330354b84c63 (patch) | |
tree | b35ac312cfac3901000662691635dc560f8b8b4d | |
parent | 85c1f5ffb945e9ce1e8772f0bd8aa08d2155ffb1 (diff) | |
download | samba-b3d4c0c9f56bd654ba92f3967eb4330354b84c63.tar.gz samba-b3d4c0c9f56bd654ba92f3967eb4330354b84c63.tar.bz2 samba-b3d4c0c9f56bd654ba92f3967eb4330354b84c63.zip |
when creating the database zero the reserved space
(This used to be commit a5ca60f62bea988e74e2827fbb848770ac5ae444)
-rw-r--r-- | source3/tdb/tdb.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c index 35951a0d17..bc7c90613c 100644 --- a/source3/tdb/tdb.c +++ b/source3/tdb/tdb.c @@ -498,6 +498,7 @@ static int tdb_new_database(TDB_CONTEXT *tdb, int hash_size) tdb_off offset; int i, size = 0; tdb_off buf[16]; + char buf2[TDB_RESERVED]; /* create the header */ memset(&header, 0, sizeof(header)); @@ -514,6 +515,13 @@ static int tdb_new_database(TDB_CONTEXT *tdb, int hash_size) tdb->ecode = TDB_ERR_IO; return -1; } else size += sizeof(header); + + memset(buf2, 0, sizeof(buf2)); + if (tdb->fd != -1 && write(tdb->fd, buf2, TDB_RESERVED) != + TDB_RESERVED) { + tdb->ecode = TDB_ERR_IO; + return -1; + } else size += TDB_RESERVED; /* the freelist and hash pointers */ offset = 0; |