summaryrefslogtreecommitdiff
path: root/source/locking/locking.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/locking/locking.c')
-rw-r--r--source/locking/locking.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/source/locking/locking.c b/source/locking/locking.c
index 2022d28ac00..012d954e501 100644
--- a/source/locking/locking.c
+++ b/source/locking/locking.c
@@ -156,21 +156,26 @@ BOOL do_unlock(files_struct *fsp,connection_struct *conn,
BOOL locking_init(int read_only)
{
- if (share_ops)
- return True;
+ if (share_ops)
+ return True;
#ifdef FAST_SHARE_MODES
- share_ops = locking_shm_init(read_only);
+ share_ops = locking_shm_init(read_only);
+ if (!share_ops && read_only && (getuid() == 0)) {
+ /* this may be the first time the share modes code has
+ been run. Initialise it now by running it read-write */
+ share_ops = locking_shm_init(0);
+ }
#else
- share_ops = locking_slow_init(read_only);
+ share_ops = locking_slow_init(read_only);
#endif
- if (!share_ops) {
- DEBUG(0,("ERROR: Failed to initialise share modes!\n"));
- return False;
- }
+ if (!share_ops) {
+ DEBUG(0,("ERROR: Failed to initialise share modes\n"));
+ return False;
+ }
- return True;
+ return True;
}
/*******************************************************************