Project

General

Profile

Bug #6081 ยป 0001-io.c-do_io_advise-raise-exception-without-segfaultin.patch

normalperson (Eric Wong), 02/25/2012 11:49 AM

View differences:

io.c
if (rv) {
/* posix_fadvise(2) doesn't set errno. On success it returns 0; otherwise
it returns the error code. */
rb_syserr_fail(rv, RSTRING_PTR(fptr->pathv));
rb_syserr_fail_str(rv, fptr->pathv);
}
return Qnil;
test/ruby/test_io.rb
end
end
def test_advise_pipe
# we don't know if other platforms have a real posix_fadvise()
return if /linux/ !~ RUBY_PLATFORM
with_pipe do |r,w|
# Linux 2.6.15 and earlier returned EINVAL instead of ESPIPE
assert_raise(Errno::ESPIPE, Errno::EINVAL) { r.advise(:willneed) }
assert_raise(Errno::ESPIPE, Errno::EINVAL) { w.advise(:willneed) }
end
end
def test_fcntl_lock_linux
return if /x86_64-linux/ !~ RUBY_PLATFORM # A binary form of struct flock depend on platform
    (1-1/1)