1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

sockets: FD_CLOEXEC

If the user code forks, it inherits open copies of all
lws sockets, which conflict if lws later decides to
close them.
This commit is contained in:
Per Bothner 2018-06-23 05:44:36 +08:00 committed by Andy Green
parent b49ef8b6d1
commit dfb4dde763

View file

@ -330,6 +330,8 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
struct protoent *tcp_proto;
#endif
fcntl(fd, F_SETFD, FD_CLOEXEC);
if (vhost->ka_time) {
/* enable keepalive on this socket */
optval = 1;