Rtems telnetd/shell question (and Why does fgetc() return 0 for a 0-length socket read?)
Peter Dufault
dufault at hda.com
Thu Oct 29 21:59:17 UTC 2009
On Oct 28, 2009, at 6:11 , Chris Johns wrote:
> I suspect we need to handle a read of the fd better. Closing a
> remote end of a socket always returns a length of 0. I do not know
> how this is handled with fget.
I'm just sitting down to look a this, and the first thing I'm asking
is how can fgetc() return 0 when the socket it is buffering returns a
0 length read? Since 0 is a valid return for fgetc() this doesn't
make any sense. I don't have too much time to write test programs
right now so I'm throwing out this question: can fgetc() return 0 for
a zero length read on an underlying socket, or is there a new lower-
level bug that is screwing things up?
The fgetc() man page isn't clear and I didn't come up with an internet
search to get the answer.
Peter
More information about the users
mailing list