summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-31 10:56:17 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-31 10:56:17 +0000
commit6d7cab3bd6db434f8299c1ef52aa62a92129f41b (patch)
tree1a904e48265886e4cae5eca58b0a71d581b0fdbc
parent67305e790df68b4009862e7a971fa7c075de5cea (diff)
downloadruby-6d7cab3bd6db434f8299c1ef52aa62a92129f41b.tar.gz
merge revision(s) 66242: [Backport #15387]
io.c (io_write_nonblock): add RB_GC_GUARD, io_fflush may switch threads Since io_fflush may block on mutex or rb_io_wait_readable and switch threads, we need to ensure the `str' VALUE returned by `rb_obj_as_string` is visible to GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@66965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--io.c1
-rw-r--r--version.h2
2 files changed, 2 insertions, 1 deletions
diff --git a/io.c b/io.c
index 4440418d96..be5c0d2b27 100644
--- a/io.c
+++ b/io.c
@@ -2712,6 +2712,7 @@ io_write_nonblock(VALUE io, VALUE str, VALUE ex)
rb_io_set_nonblock(fptr);
n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
+ RB_GC_GUARD(str);
if (n == -1) {
int e = errno;
diff --git a/version.h b/version.h
index 57e7d2a0aa..51e111fe73 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.6"
#define RUBY_RELEASE_DATE "2019-01-31"
-#define RUBY_PATCHLEVEL 340
+#define RUBY_PATCHLEVEL 341
#define RUBY_RELEASE_YEAR 2019
#define RUBY_RELEASE_MONTH 1