summaryrefslogtreecommitdiff
path: root/source3/tdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-09-18 21:17:58 +0000
committerJeremy Allison <jra@samba.org>2001-09-18 21:17:58 +0000
commitc64cd552c404f74f4f7e6aa2b4e1a6856c617011 (patch)
tree2094b3204544dedd5da2762f157ddd057d298ace /source3/tdb
parent5bc82e443b2da885aa0a504906789c006b3cf17a (diff)
downloadsamba-c64cd552c404f74f4f7e6aa2b4e1a6856c617011.tar.gz
samba-c64cd552c404f74f4f7e6aa2b4e1a6856c617011.tar.bz2
samba-c64cd552c404f74f4f7e6aa2b4e1a6856c617011.zip
Fixed a couple of nasty bugs only easily seen with no mmap. Firstly,
map_ptr not neccessarily set to NULL if no mmap, secondly, iterating through a tdb was using SETLK, instead of SETLKW - would almost never fail with mmap as the time holding the lock was so short, but was easily seen with read/write. One finaly bug needs tracking down w.r.t. traversal...... Jeremy. (This used to be commit 313c2e8652092a307165b6039dd7dfbbd0754ec3)
Diffstat (limited to 'source3/tdb')
-rw-r--r--source3/tdb/tdb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index 5c116bcf7a..0207b00222 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -108,6 +108,8 @@ static void tdb_mmap(TDB_CONTEXT *tdb)
TDB_LOG((tdb, 2, "tdb_mmap failed for size %d (%s)\n",
tdb->map_size, strerror(errno)));
}
+ } else {
+ tdb->map_ptr = NULL;
}
#else
tdb->map_ptr = NULL;
@@ -994,11 +996,11 @@ static int write_lock_record(TDB_CONTEXT *tdb, tdb_off off)
for (i = &tdb->travlocks; i; i = i->next)
if (i->off == off)
return -1;
- return tdb_brlock(tdb, off, F_WRLCK, F_SETLK, 1);
+ return tdb_brlock(tdb, off, F_WRLCK, F_SETLKW, 1);
}
static int write_unlock_record(TDB_CONTEXT *tdb, tdb_off off)
{
- return tdb_brlock(tdb, off, F_UNLCK, F_SETLK, 0);
+ return tdb_brlock(tdb, off, F_UNLCK, F_SETLKW, 0);
}
/* fcntl locks don't stack: avoid unlocking someone else's */
static int unlock_record(TDB_CONTEXT *tdb, tdb_off off)