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
7967 7967
    if (rv) {
7968 7968
	/* posix_fadvise(2) doesn't set errno. On success it returns 0; otherwise
7969 7969
	   it returns the error code. */
7970
	rb_syserr_fail(rv, RSTRING_PTR(fptr->pathv));
7970
	rb_syserr_fail_str(rv, fptr->pathv);
7971 7971
    }
7972 7972

  
7973 7973
    return Qnil;
test/ruby/test_io.rb
1902 1902
    end
1903 1903
  end
1904 1904

  
1905
  def test_advise_pipe
1906
    # we don't know if other platforms have a real posix_fadvise()
1907
    return if /linux/ !~ RUBY_PLATFORM
1908
    with_pipe do |r,w|
1909
      # Linux 2.6.15 and earlier returned EINVAL instead of ESPIPE
1910
      assert_raise(Errno::ESPIPE, Errno::EINVAL) { r.advise(:willneed) }
1911
      assert_raise(Errno::ESPIPE, Errno::EINVAL) { w.advise(:willneed) }
1912
    end
1913
  end
1914

  
1905 1915
  def test_fcntl_lock_linux
1906 1916
    return if /x86_64-linux/ !~ RUBY_PLATFORM # A binary form of struct flock depend on platform
1907 1917

  
1908
-