#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
+#include <sys/wait.h>
#include "proto.h"
#ifdef USE_SYSLOG
}
}
+static void sigchld(int signo)
+{
+ while (waitpid(-1,NULL,WNOHANG)>0);
+}
+
/*
create new thread
*/
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);