From a91d8b8c33b834f47ab000cc3844e9b18c1becba Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 19 Apr 2010 15:41:27 +0000 Subject: [PATCH] * io.c (internal_{read,write}_func, rb_{read,write}_internal): reverted r27265, since now rb_thread_blocking_region() preserves errno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ io.c | 21 ++++----------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5011128641..c92bfb8d54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Apr 20 00:41:25 2010 Nobuyoshi Nakada + + * io.c (internal_{read,write}_func, rb_{read,write}_internal): + reverted r27265, since now rb_thread_blocking_region() preserves + errno. + Mon Apr 19 23:14:45 2010 Yusuke Endoh * thread.c (rb_thread_blocking_region, rb_thread_blocking_region_end): diff --git a/io.c b/io.c index 2c18e07c75..c9ac80c816 100644 --- a/io.c +++ b/io.c @@ -530,7 +530,6 @@ wsplit_p(rb_io_t *fptr) struct io_internal_struct { int fd; - int saved_errno; void *buf; size_t capa; }; @@ -539,48 +538,36 @@ static VALUE internal_read_func(void *ptr) { struct io_internal_struct *iis = (struct io_internal_struct*)ptr; - ssize_t ret = read(iis->fd, iis->buf, iis->capa); - iis->saved_errno = errno; - return (VALUE)ret; + return read(iis->fd, iis->buf, iis->capa); } static VALUE internal_write_func(void *ptr) { struct io_internal_struct *iis = (struct io_internal_struct*)ptr; - ssize_t ret = write(iis->fd, iis->buf, iis->capa); - iis->saved_errno = errno; - return (VALUE)ret; + return write(iis->fd, iis->buf, iis->capa); } static ssize_t rb_read_internal(int fd, void *buf, size_t count) { struct io_internal_struct iis; - ssize_t ret; - iis.fd = fd; iis.buf = buf; iis.capa = count; - ret = (ssize_t)rb_thread_blocking_region(internal_read_func, &iis, RUBY_UBF_IO, 0); - errno = iis.saved_errno; - return ret; + return (ssize_t)rb_thread_blocking_region(internal_read_func, &iis, RUBY_UBF_IO, 0); } static ssize_t rb_write_internal(int fd, void *buf, size_t count) { struct io_internal_struct iis; - ssize_t ret; - iis.fd = fd; iis.buf = buf; iis.capa = count; - ret = (ssize_t)rb_thread_blocking_region(internal_write_func, &iis, RUBY_UBF_IO, 0); - errno = iis.saved_errno; - return ret; + return (ssize_t)rb_thread_blocking_region(internal_write_func, &iis, RUBY_UBF_IO, 0); } static long