aboutsummaryrefslogtreecommitdiffstats
path: root/ext/socket
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/socket/init.c b/ext/socket/init.c
index bc01217641..66da534a58 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -61,7 +61,7 @@ rsock_init_sock(VALUE sock, int fd)
{
rb_io_t *fp;
- if (!is_socket(fd)) {
+ if (!is_socket(fd) || rb_reserved_fd_p(fd)) {
errno = EBADF;
rb_sys_fail("not a socket file descriptor");
}