diff options
-rw-r--r-- | ctdb/common/ctdb_fork.c | 8 | ||||
-rw-r--r-- | ctdb/server/ctdb_daemon.c | 3 |
2 files changed, 2 insertions, 9 deletions
diff --git a/ctdb/common/ctdb_fork.c b/ctdb/common/ctdb_fork.c index aa9bcf01bc..d7eef76c78 100644 --- a/ctdb/common/ctdb_fork.c +++ b/ctdb/common/ctdb_fork.c @@ -23,11 +23,8 @@ #include "../include/ctdb_private.h" #include "../common/rb_tree.h" -static bool is_child = false; - void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, ...) { - is_child = true; if (child_name_fmt != NULL) { va_list ap; char *t; @@ -40,11 +37,6 @@ void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, ...) } } -bool ctdb_is_child_process(void) -{ - return is_child; -} - void ctdb_track_child(struct ctdb_context *ctdb, pid_t pid) { char *process; 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)); |