>>>>> "Y" == Yukihiro Matsumoto <matz / ruby-lang.org> writes:

Y> I want to fix this.  But I don't still understand the problem.

Y>   * server.rb read the socket (by getc(3) in appendline).
Y>   * getc returned EOF, which means end-of-file or error.
Y>   * appendline called ferror(3) to determine if it's error, not EOF.
Y>   * but errno is zero, so that rb_sys_fail() failed.

 Well, server.rb is

    loop {
      begin
        line = socket.gets
        puts line
      rescue
      end
    }

 When the client die : the first #gets return EOF, ruby call rb_sys_fail()
 but the error is discarded because there is a rescue. 

 When ruby call #gets for the second time, it return EOF and errno is not
 set but ferror() give an error. 


Guy Decoux