s3:winbindd: fix problems with SIGCHLD handling (bug #7317)
[samba.git] / source3 / winbindd / winbindd.c
index 13cadffab8eec02f05b581422a259e97d7c50c18..d1d33d39f80221e0040c86d07ab765e971a837f0 100644 (file)
@@ -407,7 +407,6 @@ static void winbind_msg_validate_cache(struct messaging_context *msg_ctx,
         * so we don't block the main winbindd and the validation
         * code can safely use fork/waitpid...
         */
-       CatchChild();
        child_pid = sys_fork();
 
        if (child_pid == -1) {
@@ -425,16 +424,9 @@ static void winbind_msg_validate_cache(struct messaging_context *msg_ctx,
 
        /* child */
 
-       /* install default SIGCHLD handler: validation code uses fork/waitpid */
-       ZERO_STRUCT(act);
-       act.sa_handler = SIG_DFL;
-#ifdef SA_RESTART
-       /* We *want* SIGALRM to interrupt a system call. */
-       act.sa_flags = SA_RESTART;
-#endif
-       sigemptyset(&act.sa_mask);
-       sigaddset(&act.sa_mask,SIGCHLD);
-       sigaction(SIGCHLD,&act,&oldact);
+       if (!winbindd_reinit_after_fork(NULL)) {
+               _exit(0);
+       }
 
        ret = (uint8)winbindd_validate_cache_nobackup();
        DEBUG(10, ("winbindd_msg_validata_cache: got return value %d\n", ret));