From 4139024e15d2514246e71baed24efa00ef369b1b Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 31 Jan 2018 17:26:20 +0000 Subject: [PATCH] io.c: fix fptr_copy_finalizer * io.c (fptr_copy_finalizer): fix inverted condition. if finalizer does not change, pipe_list should not change too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/io.c b/io.c index d53f9c0df2..eb12d95fe4 100644 --- a/io.c +++ b/io.c @@ -6201,12 +6201,14 @@ fptr_copy_finalizer(rb_io_t *fptr, const rb_io_t *orig) { #if defined(__CYGWIN__) || !defined(HAVE_WORKING_FORK) void (*const old_finalize)(struct rb_io_t*,int) = fptr->finalize; + + if (old_finalize == fptr->finalize) return; #endif fptr->finalize = orig->finalize; #if defined(__CYGWIN__) || !defined(HAVE_WORKING_FORK) - if (old_finalize == pipe_finalize) { + if (old_finalize != pipe_finalize) { struct pipe_list *list; for (list = pipe_list; list; list = list->next) { if (list->fptr == fptr) break;