util: Do not try to lockdown memory when running in local daemons mode
authorAmitay Isaacs <amitay@gmail.com>
Wed, 6 Jun 2012 06:16:15 +0000 (16:16 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 16 Jul 2012 02:12:05 +0000 (12:12 +1000)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit 25f84797a64a683c303b04057aa8113e9fc47c49)

ctdb/common/ctdb_util.c

index b9af95bfb1be52596cd6e3b2811b1e5c1fae9287..30effdd52efe5d7d79551b8deafb8427f2b3a6ec 100644 (file)
@@ -642,10 +642,15 @@ void ctdb_lockdown_memory(struct ctdb_context *ctdb)
                return;
        }
 
+       /* Ignore when running in local daemons mode */
+       if (getpid() != 0) {
+               return;
+       }
+
        /* Avoid compiler optimizing out dummy. */
        mlock(dummy, sizeof(dummy));
        if (mlockall(MCL_CURRENT) != 0) {
-               DEBUG(DEBUG_WARNING,("Failed to lock memory: %s'\n",
+               DEBUG(DEBUG_WARNING,("Failed to lockdown memory: %s'\n",
                                     strerror(errno)));
        }
 #endif