1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-01-29 11:08:16 +00:00
parent c5f2c66270
commit 3d3a02c97f
2 changed files with 10 additions and 0 deletions

View file

@ -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

4
io.c
View file

@ -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;