]> prime8.dev >> repos - ttyd.git/commitdiff
Close the websocket after forking so that child processes don't prevent new connectio...
authordmayle <douglas@mayle.org>
Sat, 16 Mar 2019 03:08:37 +0000 (03:08 +0000)
committerShuanglei Tao <tsl0922@gmail.com>
Sat, 16 Mar 2019 03:08:37 +0000 (11:08 +0800)
src/protocol.c

index e4204cb116fe0e2d94ecfcf82d72f8e6d858641d..9f1ada5d49b1d52687bfcd3897e9ec6d04ee5c1b 100644 (file)
@@ -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
+}