summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-23 08:13:37 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-23 08:13:37 +0000
commit5314b52068c6e795917842e1397eaf07e564eb0b (patch)
tree54efd7edfe343c3af5543951e820cab326da5004 /io.c
parent1a4df6863dfcbc993818ee261ec8e0bdedf67411 (diff)
* io.c (rb_update_max_fd): validate fd.
* ext/socket/rubysocket.h (rsock_discard_cmsg_resource): add msg_peek_p argument for the declaration. * ext/socket/ancdata.c (discard_cmsg): add msg_peek_p argument. assume FreeBSD, NetBSD and MacOS X doesn't generate passed fd when MSG_PEEK. (rsock_discard_cmsg_resource): add msg_peek_p argument. (bsock_recvmsg_internal): call rsock_discard_cmsg_resource with msg_peek_p argument. * ext/socket/unixsocket.c (unix_recv_io): call rsock_discard_cmsg_resource with msg_peek_p argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/io.c b/io.c
index 840498c94c..5307ad4d3f 100644
--- a/io.c
+++ b/io.c
@@ -154,6 +154,10 @@ static int max_file_descriptor = NOFILE;
void
rb_update_max_fd(int fd)
{
+ struct stat buf;
+ if (fstat(fd, &buf) != 0) {
+ rb_bug("rb_update_max_fd: invalid fd (%d) given.", fd);
+ }
if (max_file_descriptor < fd) max_file_descriptor = fd;
}