diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-01-18 15:45:22 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2008-01-18 15:45:22 +1100 |
commit | 61a015a786c52008f4471e62750ad93507bce518 (patch) | |
tree | 2942464148744495584b3495f4d325abc3a5d758 /source4/lib/tdb/common/open.c | |
parent | 524d280ad09c99bcbf63d789e909afdf7edb5860 (diff) | |
download | samba-61a015a786c52008f4471e62750ad93507bce518.tar.gz samba-61a015a786c52008f4471e62750ad93507bce518.tar.bz2 samba-61a015a786c52008f4471e62750ad93507bce518.zip |
merged changes from v3-2-test
(This used to be commit 7077df3e2e3f171532f6a5ac87d45201736c9c11)
Diffstat (limited to 'source4/lib/tdb/common/open.c')
-rw-r--r-- | source4/lib/tdb/common/open.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/source4/lib/tdb/common/open.c b/source4/lib/tdb/common/open.c index 6bd8fda2bf..b19e4cea29 100644 --- a/source4/lib/tdb/common/open.c +++ b/source4/lib/tdb/common/open.c @@ -179,9 +179,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->page_size = 0x2000; } - if (open_flags & TDB_VOLATILE) { - tdb->max_dead_records = 5; - } + tdb->max_dead_records = (tdb_flags & TDB_VOLATILE) ? 5 : 0; if ((open_flags & O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n", @@ -229,6 +227,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, /* we need to zero database if we are the only one with it open */ if ((tdb_flags & TDB_CLEAR_IF_FIRST) && + (!tdb->read_only) && (locked = (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0, 1) == 0))) { open_flags |= O_CREAT; if (ftruncate(tdb->fd, 0) == -1) { @@ -288,7 +287,6 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; - tdb->max_dead_records = 0; tdb_mmap(tdb); if (locked) { if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) { |