diff -uNr partimage-0.6.6.orig/src/server/partimaged-main.cpp partimage-0.6.6/src/server/partimaged-main.cpp --- partimage-0.6.6.orig/src/server/partimaged-main.cpp 2008-01-15 12:32:50.000000000 +0100 +++ partimage-0.6.6/src/server/partimaged-main.cpp 2008-01-15 12:36:06.000000000 +0100 @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include "net.h" #include "netserver.h" @@ -321,6 +323,7 @@ signal(SIGTERM, catch_sigint); signal(SIGINT, catch_sigint); signal(SIGSEGV, catch_sigint); // segmentation fault + signal(SIGCHLD, SIG_IGN); // ignore child exits // signal(SIGHUP, catch_sigint); // signal(SIGQUIT, catch_sigint); // signal(SIGCHLD, catch_sigint); @@ -426,9 +429,15 @@ g_Window->SetLocation(client, "(wrong password)"); } else - pthread_create(&threads[client], NULL, - partimaged, &client); - + { + int rv = fork(); + if ( rv < 0 ) + { + showDebug(1, "Cannot fork() on incoming connection - %s\n", strerror(errno)); + continue; + } + if ( ! rv ) partimaged(&client); // child process + } } // infernal loop showDebug(1, "end of partimaged-main\n");