summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap_child_helpers.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-05-02 08:07:50 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-05-16 13:28:13 -0400
commitaf971fb6cf853c3a5f41aa00918013903aba1ff3 (patch)
tree7de3dfd0e6bb7d783f070e577340b3475013ef1b /src/providers/ldap/sdap_child_helpers.c
parent928ff09ea3975edbf53df05a1ade365a588dc69d (diff)
downloadsssd-af971fb6cf853c3a5f41aa00918013903aba1ff3.tar.gz
sssd-af971fb6cf853c3a5f41aa00918013903aba1ff3.tar.xz
sssd-af971fb6cf853c3a5f41aa00918013903aba1ff3.zip
Properly set up SIGCHLD handlers
Instead of having all-purpose SIGCHLD handlers that try to catch every occurrence, we instead create a per-PID handler. This will allow us to specify callbacks to occur when certain children exit.
Diffstat (limited to 'src/providers/ldap/sdap_child_helpers.c')
-rw-r--r--src/providers/ldap/sdap_child_helpers.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/providers/ldap/sdap_child_helpers.c b/src/providers/ldap/sdap_child_helpers.c
index 273fc6787..c61f3cceb 100644
--- a/src/providers/ldap/sdap_child_helpers.c
+++ b/src/providers/ldap/sdap_child_helpers.c
@@ -77,7 +77,8 @@ static int sdap_child_destructor(void *ptr)
return 0;
}
-static errno_t sdap_fork_child(struct sdap_child *child)
+static errno_t sdap_fork_child(struct tevent_context *ev,
+ struct sdap_child *child)
{
int pipefd_to_child[2];
int pipefd_from_child[2];
@@ -118,6 +119,11 @@ static errno_t sdap_fork_child(struct sdap_child *child)
fd_nonblocking(child->read_from_child_fd);
fd_nonblocking(child->write_to_child_fd);
+ ret = child_handler_setup(ev, pid, NULL, NULL);
+ if (ret != EOK) {
+ return ret;
+ }
+
} else { /* error */
err = errno;
DEBUG(1, ("fork failed [%d][%s].\n", err, strerror(err)));
@@ -275,7 +281,7 @@ struct tevent_req *sdap_get_tgt_send(TALLOC_CTX *mem_ctx,
goto fail;
}
- ret = sdap_fork_child(state->child);
+ ret = sdap_fork_child(state->ev, state->child);
if (ret != EOK) {
DEBUG(1, ("sdap_fork_child failed.\n"));
goto fail;
@@ -422,7 +428,6 @@ int setup_child(struct sdap_id_ctx *ctx)
{
int ret;
const char *mech;
- struct tevent_signal *sige;
unsigned v;
FILE *debug_filep;
@@ -432,13 +437,6 @@ int setup_child(struct sdap_id_ctx *ctx)
return EOK;
}
- sige = tevent_add_signal(ctx->be->ev, ctx, SIGCHLD, SA_SIGINFO,
- child_sig_handler, NULL);
- if (sige == NULL) {
- DEBUG(1, ("tevent_add_signal failed.\n"));
- return ENOMEM;
- }
-
if (debug_to_file != 0 && ldap_child_debug_fd == -1) {
ret = open_debug_file_ex("ldap_child", &debug_filep);
if (ret != EOK) {