aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-29 11:08:16 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-29 11:08:16 +0000
commit3d3a02c97fba5ab46d3685c8266c859838fdd6a9 (patch)
treee283c3807eb9ab0dca688e80e0f227deb72034f8
parentc5f2c66270be83a8263cce40cfe9a516c11e6e27 (diff)
downloadruby-3d3a02c97fba5ab46d3685c8266c859838fdd6a9.tar.gz
io.c: check socket on other than linux
* io.c (nogvl_copy_stream_sendfile): check socket on other than linux, as sendfile(2) on non-socket fd works only on linux. [Feature #9427] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--io.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a6b031a86..ded0ed62fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Jan 29 20:08:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (nogvl_copy_stream_sendfile): check socket on other than
+ linux, as sendfile(2) on non-socket fd works only on linux.
+ [Feature #9427]
+
Wed Jan 29 18:09:48 2014 Eric Wong <e@80x24.org>
* io.c (nogvl_copy_stream_sendfile): remove socket check
diff --git a/io.c b/io.c
index 00f9abc2c5..0020f4704a 100644
--- a/io.c
+++ b/io.c
@@ -10062,6 +10062,10 @@ nogvl_copy_stream_sendfile(struct copy_stream_struct *stp)
stp->error_no = errno;
return -1;
}
+#ifndef __linux__
+ if ((dst_stat.st_mode & S_IFMT) != S_IFSOCK)
+ return 0;
+#endif
src_offset = stp->src_offset;
use_pread = src_offset != (off_t)-1;