s3:winbindd: fix problems with SIGCHLD handling (bug #7317)
[samba.git] / source3 / winbindd / winbindd.c
index e98b7994adb20d493640046cf840b9443eb8540e..eb5429c3efb28b7a32f4458180c5dd8fa7852b68 100644 (file)
@@ -378,7 +378,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) {
@@ -396,16 +395,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));