mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-30 23:49:01 +08:00
Fix FD_CLOEXEC setting
This commit is contained in:
parent
975db86306
commit
093cd6a6a3
@ -2976,7 +2976,8 @@ static void mg_set_non_blocking_mode(SOCKET fd) {
|
||||
#elif MG_ARCH == MG_ARCH_AZURERTOS
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
#else
|
||||
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK | FD_CLOEXEC);
|
||||
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); // Set non-blocking mode
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC); // Set close-on-exec
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,8 @@ static void mg_set_non_blocking_mode(SOCKET fd) {
|
||||
#elif MG_ARCH == MG_ARCH_AZURERTOS
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
#else
|
||||
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK | FD_CLOEXEC);
|
||||
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); // Set non-blocking mode
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC); // Set close-on-exec
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user