From: Brian Candler Date: 2003-08-02T21:17:15+09:00 Subject: Re: 1.8.0-previewX rb_sys_fail() on socket instead of an Exception. On Sat, Aug 02, 2003 at 08:53:03PM +0900, ts wrote: > The problem is that appendline() use ferror() when rb_sys_fail() use > errno. On linux I have > > These functions should not fail and do not set the external variable > ^^^^^^^^^^ > errno. (However, in case fileno detects that its argument is not a > valid stream, it must return -1 and set errno to EBADF.) Interesting. The FreeBSD manpage for ferror says exactly the same, although omits the sentence in brackets. However, 'man getc' says: RETURN VALUES If successful, these routines return the next requested object from the stream. Character values are returned as an unsigned char converted to an int. If the stream is at end-of-file or a read error occurs, the rou- tines return EOF. The routines feof(3) and ferror(3) must be used to distinguish between end-of-file and error. If an error occurs, the ^^^^^^^^^^^^^^^^^^^^^^^ global variable errno is set to indicate the error. The end-of-file con- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dition is remembered, even on a terminal, and all subsequent attempts to read will return EOF until the condition is cleared with clearerr(3). Does this mean that Linux's ferror is actually *clearing* errno? Or there is some circumstance where ferror() returns true but errno is unset? Regards, Brian.