summaryrefslogtreecommitdiffstats
path: root/ctdb/server/ctdb_daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb/server/ctdb_daemon.c')
-rw-r--r--ctdb/server/ctdb_daemon.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index eb42e18886..448e7dcc98 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -1109,7 +1109,8 @@ static void ctdb_tevent_trace(enum tevent_trace_point tp,
static void ctdb_remove_pidfile(void)
{
- if (ctdbd_pidfile != NULL && !ctdb_is_child_process()) {
+ /* Only the main ctdbd's PID matches the SID */
+ if (ctdbd_pidfile != NULL && getsid(0) == getpid()) {
if (unlink(ctdbd_pidfile) == 0) {
DEBUG(DEBUG_NOTICE, ("Removed PID file %s\n",
ctdbd_pidfile));