Skip to content

Commit 404d166

Browse files
arrowdalexey-tikhonov
authored andcommitted
sdap_select_principal_from_keytab_sync: waitpid() synchronously
Without this change the ldap_child process started by this function ends up in the <defunct> state. kernel trace hints that the process isn't fully finished by the time waitpid is called: 13126 sssd_be CALL wait4(13127,0,0x1<WNOHANG>,0) 13126 sssd_be RET wait4 0 waitpid(ldap_child) failed, process might be leaking According to man waitpid(3), the function returns 0 when passed WNOHANG and there is no child process that can be reported as exited. Omitting WNOHANG fixes the issue. Reviewed-by: Alexey Tikhonov <atikhono@redhat.com> Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
1 parent c6dc4d7 commit 404d166

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/providers/ldap/sdap_child_helpers.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ errno_t sdap_select_principal_from_keytab_sync(TALLOC_CTX *mem_ctx,
264264

265265
FD_CLOSE(io->read_from_child_fd);
266266

267-
if (waitpid(io->pid, NULL, WNOHANG) != io->pid) {
268-
DEBUG(SSSDBG_MINOR_FAILURE, "waitpid(ldap_child) failed, "
269-
"process might be leaking\n");
267+
if (waitpid(io->pid, NULL, 0) != io->pid) {
268+
DEBUG(SSSDBG_CRIT_FAILURE, "waitpid(ldap_child) failed: [%d][%s]\n",
269+
errno, strerror(errno));
270270
}
271271

272272
ret = parse_select_principal_response(mem_ctx, response, len,

0 commit comments

Comments
 (0)