summaryrefslogtreecommitdiff
path: root/source3/lib/tdb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-01-16 21:18:26 +0100
committerVolker Lendecke <vl@samba.org>2008-01-16 21:18:26 +0100
commit5b37e815b429f0a8c114e36892385d8b0d86ea6a (patch)
tree9c20dda22a996120d7e24c3beacef74549b2042c /source3/lib/tdb
parent7084854bd94c84250becc7e4e13035fde2d7a728 (diff)
downloadsamba-5b37e815b429f0a8c114e36892385d8b0d86ea6a.tar.gz
samba-5b37e815b429f0a8c114e36892385d8b0d86ea6a.tar.bz2
samba-5b37e815b429f0a8c114e36892385d8b0d86ea6a.zip
Don't try ftruncate when the tdb is opened read-only
Tridge, Jeremy, please check! Thanks, Volker (This used to be commit e4f46d527411c54e8f26c05033b744c751810c32)
Diffstat (limited to 'source3/lib/tdb')
-rw-r--r--source3/lib/tdb/common/open.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/source3/lib/tdb/common/open.c b/source3/lib/tdb/common/open.c
index 2a438971d4..b19e4cea29 100644
--- a/source3/lib/tdb/common/open.c
+++ b/source3/lib/tdb/common/open.c
@@ -227,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) {