summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-05-17 11:52:00 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2016-05-19 13:56:57 +0200
commitde8815aba87d08b6b7ac5d502dcb1755787e0857 (patch)
tree32a7cf823321aa6ff5af4173d6613b06d89244ca /src/providers/ldap
parentc2e3176eaff7c219d63f328570a79f6e5b6f4aec (diff)
downloadsssd-de8815aba87d08b6b7ac5d502dcb1755787e0857.tar.gz
sssd-de8815aba87d08b6b7ac5d502dcb1755787e0857.tar.xz
sssd-de8815aba87d08b6b7ac5d502dcb1755787e0857.zip
UTIL: exit() the forked process if exec()-ing a child process fails
When exec() fails, we should not attempt to continue, but just kill the forked process. The patch adds this logic to the exec_child() and exec_child_ex() functions to avoid code duplication Resolves: https://fedorahosted.org/sssd/ticket/3016 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/providers/ldap')
-rw-r--r--src/providers/ldap/sdap_child_helpers.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/providers/ldap/sdap_child_helpers.c b/src/providers/ldap/sdap_child_helpers.c
index 90330f13f..69b470dbf 100644
--- a/src/providers/ldap/sdap_child_helpers.c
+++ b/src/providers/ldap/sdap_child_helpers.c
@@ -96,12 +96,12 @@ static errno_t sdap_fork_child(struct tevent_context *ev,
pid = fork();
if (pid == 0) { /* child */
- err = exec_child(child,
- pipefd_to_child, pipefd_from_child,
- LDAP_CHILD, ldap_child_debug_fd);
- DEBUG(SSSDBG_CRIT_FAILURE, "Could not exec LDAP child: [%d][%s].\n",
- err, strerror(err));
- return err;
+ exec_child(child,
+ pipefd_to_child, pipefd_from_child,
+ LDAP_CHILD, ldap_child_debug_fd);
+
+ /* We should never get here */
+ DEBUG(SSSDBG_CRIT_FAILURE, "BUG: Could not exec LDAP child\n");
} else if (pid > 0) { /* parent */
child->pid = pid;
child->io->read_from_child_fd = pipefd_from_child[0];