Removed threading
authorshort <>
Mon, 18 Nov 2002 13:38:16 +0000 (13:38 +0000)
committershort <>
Mon, 18 Nov 2002 13:38:16 +0000 (13:38 +0000)
src/main.c

index f188421..d870628 100644 (file)
@@ -27,6 +27,7 @@
 #include <fcntl.h>
 #include <pwd.h>
 #include <grp.h>
+#include <sys/wait.h>
 #include "proto.h"
 
 #ifdef USE_SYSLOG
@@ -512,6 +513,11 @@ void mainloop()
        }
 }
 
+static void sigchld(int signo)
+{
+       while (waitpid(-1,NULL,WNOHANG)>0);
+}
+
 /*
 create new thread
 */
@@ -548,7 +554,12 @@ int process_new(CONNECTION * connection)
        if (getuid() == 0)
                pthread_attr_setschedpolicy(&thread_attr, SCHED_FIFO);
 
-       perr = pthread_create(&thread_id, &thread_attr, (void *) process_entry, (void *) connection);
+       signal(SIGCHLD,sigchld);
+       if (0==(perr=fork())) {
+               process_entry(connection);
+               _exit(0);
+               }
+       perr=close(connection->client->fd)
 
        pthread_attr_destroy(&thread_attr);