summaryrefslogtreecommitdiff
path: root/server/providers
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-08-03 11:55:36 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-08-11 12:29:35 -0400
commitdd8aaf74198c084fd0aa712d56c4511978f04ebe (patch)
tree32b5b07a2781ffe2381265f3ffeb8202cd216e91 /server/providers
parentb3b55f167063417c285524ba35bd9298965b834a (diff)
downloadsssd-dd8aaf74198c084fd0aa712d56c4511978f04ebe.tar.gz
sssd-dd8aaf74198c084fd0aa712d56c4511978f04ebe.tar.bz2
sssd-dd8aaf74198c084fd0aa712d56c4511978f04ebe.zip
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.
Diffstat (limited to 'server/providers')
-rw-r--r--server/providers/data_provider.c6
-rw-r--r--server/providers/data_provider_be.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c
index b9529254..f0ecd30b 100644
--- a/server/providers/data_provider.c
+++ b/server/providers/data_provider.c
@@ -1088,6 +1088,12 @@ int main(int argc, const char *argv[])
ret = server_setup("sssd[dp]", 0, DP_CONF_ENTRY, &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 = dp_process_init(main_ctx,
main_ctx->event_ctx,
main_ctx->confdb_ctx);
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index c93c4531..49885edc 100644
--- a/server/providers/data_provider_be.c
+++ b/server/providers/data_provider_be.c
@@ -1109,6 +1109,12 @@ int main(int argc, const char *argv[])
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 = be_process_init(main_ctx,
be_name, be_domain,
main_ctx->event_ctx,