1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

O_EXCL has no meaning for fdopen

"exclusive access mode is not supported" exception has resulted in
empty "rubyheap-*.json" files after test/objspace/test_objspace.rb.
This commit is contained in:
Nobuyoshi Nakada 2019-06-28 12:02:33 +09:00
parent 14b0c94ac3
commit ff7f71b288
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 4 additions and 4 deletions

2
io.c
View file

@ -8037,7 +8037,7 @@ FILE *
rb_io_stdio_file(rb_io_t *fptr)
{
if (!fptr->stdio_file) {
int oflags = rb_io_fmode_oflags(fptr->mode);
int oflags = rb_io_fmode_oflags(fptr->mode) & ~O_EXCL;
fptr->stdio_file = rb_fdopen(fptr->fd, rb_io_oflags_modestr(oflags));
}
return fptr->stdio_file;

View file

@ -406,10 +406,10 @@ class TestObjSpace < Test::Unit::TestCase
puts dump_my_heap_please
end;
skip if /is not supported/ =~ error
skip error unless output
assert_match(entry, File.readlines(output).grep(/TEST STRING/).join("\n"))
assert_nil(error)
dump = File.readlines(output)
File.unlink(output)
assert_match(entry, dump.grep(/TEST STRING/).join("\n"))
end
if defined?(JSON)