Skip to content

Commit 9c65768

Browse files
committed
Only call close if the IO actually has a non-closed descriptor
* @descriptor is never null for us, either -1 (closed) or a valid fd.
1 parent 48a2da7 commit 9c65768

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/ruby/core/io.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ def self.setup(io, fd, mode=nil, sync=false)
11491149
end
11501150

11511151
# Close old descriptor if there was already one associated
1152-
io.close if io.descriptor
1152+
io.close if io.descriptor != -1
11531153

11541154
io.descriptor = fd
11551155
io.mode = mode || cur_mode

0 commit comments

Comments
 (0)