From: dmayle Date: Sat, 16 Mar 2019 03:08:37 +0000 (+0000) Subject: Close the websocket after forking so that child processes don't prevent new connectio... X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=0b44b9b943752cede6fa25e42a83207caf67cdf6;p=ttyd.git Close the websocket after forking so that child processes don't prevent new connections (#162) --- diff --git a/src/protocol.c b/src/protocol.c index e4204cb..9f1ada5 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -180,6 +180,8 @@ thread_run_command(void *args) { perror("setenv"); pthread_exit((void *) 1); } + // Don't pass the web socket onto child processes + close(lws_get_socket_fd(client->wsi)); if (execvp(server->argv[0], server->argv) < 0) { perror("execvp"); pthread_exit((void *) 1); @@ -401,4 +403,4 @@ callback_tty(struct lws *wsi, enum lws_callback_reasons reason, } return 0; -} \ No newline at end of file +}