Fix #1302 - set FD_CLOEXEC on sockets

This commit is contained in:
Sergey Lyubka
2021-07-13 19:32:31 +01:00
parent 5e466f9037
commit db11897d71
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -2732,7 +2732,7 @@ static void mg_set_non_blocking_mode(SOCKET fd) {
setsockopt(fd, 0, FREERTOS_SO_RCVTIMEO, &off, sizeof(off));
setsockopt(fd, 0, FREERTOS_SO_SNDTIMEO, &off, sizeof(off));
#else
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK | FD_CLOEXEC);
#endif
}
+1 -1
View File
@@ -126,7 +126,7 @@ static void mg_set_non_blocking_mode(SOCKET fd) {
setsockopt(fd, 0, FREERTOS_SO_RCVTIMEO, &off, sizeof(off));
setsockopt(fd, 0, FREERTOS_SO_SNDTIMEO, &off, sizeof(off));
#else
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK | FD_CLOEXEC);
#endif
}