summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1999-07-14 14:16:22 +0000
committerAndrew Tridgell <tridge@samba.org>1999-07-14 14:16:22 +0000
commitffc9e0e2d22be19abb60fb24a904b5a25ac21481 (patch)
treeb3243a441be5c2cafef9c6e34c4f5a589234c166
parent27678c28f60147768fb20f3aee841ff78b1718e6 (diff)
downloadsamba-ffc9e0e2d22be19abb60fb24a904b5a25ac21481.tar.gz
if the share modes fail to initialise and we are root then allow them
to init read-write. This allows people to run smbstatus directly after a install/upgrade without nasty messages.
-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;
}
/*******************************************************************