diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-27 04:30:31 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-27 04:30:31 +0000 |
commit | d9edd4ca87bff687dc9548de6517792443746ddd (patch) | |
tree | d5703a7aa22e5e6462dfbd4b9b6cac69dfa8b514 | |
parent | 165ebcd5acbf65373418db78a5e932c08f5a2bf6 (diff) | |
download | ruby-d9edd4ca87bff687dc9548de6517792443746ddd.tar.gz |
* io.c (simple_sendfile): don't try to send data more than SSIZE_MAX
with single sendfile call..
based on the patch by Eric Wong. [ruby-core:30908]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | io.c | 9 |
2 files changed, 13 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Sun Jun 27 13:25:07 2010 Tanaka Akira <akr@fsij.org> + + * io.c (simple_sendfile): don't try to send data more than SSIZE_MAX + with single sendfile call.. + based on the patch by Eric Wong. [ruby-core:30908] + Sun Jun 27 10:41:38 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/rubygems/require_paths_builder.rb (write_require_paths_file_if_needed): @@ -8078,9 +8078,14 @@ nogvl_copy_stream_wait_write(struct copy_stream_struct *stp) #endif static ssize_t -simple_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) +simple_sendfile(int out_fd, int in_fd, off_t *offset, off_t count) { - return sendfile(out_fd, in_fd, offset, count); +#if SIZEOF_OFF_T > SIZEOF_SIZE_T + /* we are limited by the 32-bit ssize_t return value on 32-bit */ + if (count > (off_t)SSIZE_MAX) + count = SSIZE_MAX; +#endif + return sendfile(out_fd, in_fd, offset, (size_t)count); } #endif |