If fork()ing, parent process must close child's socket fd. Child close() is not sufficient as both parent and child have a reference to the same socket fd, and fd will never be free'd if close() is not called from both processes.

This commit is contained in:
Michael Jumper 2011-07-12 14:43:57 -07:00
parent 71013a5a1b
commit 66c1144d4e

View File

@ -302,6 +302,11 @@ int main(int argc, char* argv[]) {
return 0;
}
/* If parent, close reference to child's descriptor */
else if (CLOSE_SOCKET(connected_socket_fd) < 0) {
guac_log_error("Error closing daemon reference to child descriptor: %s", lasterror());
}
#else
if (guac_thread_create(&thread, start_client_thread, (void*) data))