lib/util: Remove obsolete sys_getpid() and sys_fork().
[ab/samba.git/.git] / source3 / winbindd / winbindd.c
index d1d36fd0073859c71104a6cfd775cf199678ce6f..a3b21425a000c22fc0ce17c42632e9688ab6db73 100644 (file)
@@ -431,7 +431,7 @@ 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...
         */
-       child_pid = sys_fork();
+       child_pid = fork();
 
        if (child_pid == -1) {
                DEBUG(1, ("winbind_msg_validate_cache: Could not fork: %s\n",
@@ -1461,6 +1461,17 @@ int main(int argc, char **argv, char **envp)
                exit(1);
        }
 
+       /*
+        * Do not initialize the parent-child-pipe before becoming
+        * a daemon: this is used to detect a died parent in the child
+        * process.
+        */
+       status = init_before_fork();
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("init_before_fork failed: %s\n", nt_errstr(status)));
+               exit(1);
+       }
+
        winbindd_register_handlers(!Fork);
 
        status = init_system_info();