diff options
Diffstat (limited to 'ext/socket/init.c')
-rw-r--r-- | ext/socket/init.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/socket/init.c b/ext/socket/init.c index ad25ccb080..92cca7c057 100644 --- a/ext/socket/init.c +++ b/ext/socket/init.c @@ -270,8 +270,16 @@ rsock_socket(int domain, int type0, int proto) fd = socket(domain, type, proto); } } +#ifdef SOCK_CLOEXEC if (0 <= fd) - rb_update_max_fd(fd); + if (try_sock_cloexec) + rb_update_max_fd(fd); + else + rb_fd_fix_cloexec(fd); +#else + if (0 <= fd) + rb_fd_fix_cloexec(fd); +#endif return fd; } |