From ffc9e0e2d22be19abb60fb24a904b5a25ac21481 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 14 Jul 1999 14:16:22 +0000 Subject: 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. --- source/locking/locking.c | 23 ++++++++++++++--------- 1 file 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; } /******************************************************************* -- cgit v1.2.1