From dd8aaf74198c084fd0aa712d56c4511978f04ebe Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 3 Aug 2009 11:55:36 +0200 Subject: Make child processes exit when parent dies The child processes call prctl() and when their parent process is killed, they are sent SIGTERM using prctl. This is currently Linux-specific, for non-Linuxes, a similar effect is achieved by catching a set of common termination signals and sending SIGTERM to the process group. --- server/responder/nss/nsssrv.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'server/responder/nss') diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c index 248d53843..418e2f9f6 100644 --- a/server/responder/nss/nsssrv.c +++ b/server/responder/nss/nsssrv.c @@ -365,6 +365,12 @@ int main(int argc, const char *argv[]) ret = server_setup("sssd[nss]", 0, NSS_SRV_CONFIG, &main_ctx); if (ret != EOK) return 2; + ret = die_if_parent_died(); + if (ret != EOK) { + /* This is not fatal, don't return */ + DEBUG(2, ("Could not set up to exit when parent process does\n")); + } + ret = nss_process_init(main_ctx, main_ctx->event_ctx, main_ctx->confdb_ctx); -- cgit