diff options
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/locking.c | 2 | ||||
-rw-r--r-- | source3/locking/posix.c | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 302b5b56c9..8fc1c4a4bc 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -233,7 +233,7 @@ BOOL locking_init(int read_only) return False; } - if (!posix_locking_init()) + if (!posix_locking_init(read_only)) return False; return True; diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 6ab4bef4cc..69df55ba3c 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -1346,25 +1346,25 @@ void posix_locking_close_file(files_struct *fsp) Create the in-memory POSIX lock databases. ********************************************************************/ -BOOL posix_locking_init(void) +BOOL posix_locking_init(int read_only) { if (posix_lock_tdb && posix_pending_close_tdb) return True; - + if (!posix_lock_tdb) posix_lock_tdb = tdb_open(NULL, 0, TDB_INTERNAL, - O_RDWR|O_CREAT, 0644); - if (!posix_lock_tdb) { - DEBUG(0,("Failed to open POSIX byte range locking database.\n")); + read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644); + if (!posix_lock_tdb) { + DEBUG(0,("Failed to open POSIX byte range locking database.\n")); return False; - } + } if (!posix_pending_close_tdb) posix_pending_close_tdb = tdb_open(NULL, 0, TDB_INTERNAL, - O_RDWR|O_CREAT, 0644); - if (!posix_pending_close_tdb) { - DEBUG(0,("Failed to open POSIX pending close database.\n")); + read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644); + if (!posix_pending_close_tdb) { + DEBUG(0,("Failed to open POSIX pending close database.\n")); return False; - } + } return True; } |