summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-21 17:16:18 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-21 17:16:18 +0000
commitef0eca37398beea19ca786456c9adc86789e9f98 (patch)
tree590ccc606433f07a560c5eec1524e36c1d287098 /ext
parent67ac3f7c529a47d36ec8fa1f4417d2042d0b23f7 (diff)
downloadruby-ef0eca37398beea19ca786456c9adc86789e9f98.tar.gz
ruby-ef0eca37398beea19ca786456c9adc86789e9f98.tar.xz
ruby-ef0eca37398beea19ca786456c9adc86789e9f98.zip
* ext/socket/ancdata.c (bsock_recvmsg_internal): handle EMSGSIZE as
well. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/ancdata.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index e3f56fe50..674923e3e 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -1298,8 +1298,13 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (nonblock && errno == EWOULDBLOCK)
rb_sys_fail("recvmsg(2) WANT_READ");
#if defined(HAVE_ST_MSG_CONTROL)
- if (errno == EMFILE && !gc_done) {
- /* SCM_RIGHTS hit the file descriptors limit, maybe. */
+ if (!gc_done && (errno == EMFILE || errno == EMSGSIZE)) {
+ /*
+ * When SCM_RIGHTS hit the file descriptors limit:
+ * - Linux 2.6.18 causes success with MSG_CTRUNC
+ * - MacOS X 10.4 causes EMSGSIZE (and lost file descriptors?)
+ * - Solaris 11 causes EMFILE
+ */
gc_and_retry:
rb_gc();
gc_done = 1;