If `sread' receives an EOF it will now close the file descriptor and return an
error. Prior to this revision it would try to read again and possibly fail
then.. Alternatively it might have crashed, who knows..? ;)
if (status < 0)
return (status);
+ if (status == 0)
+ {
+ DBG ("Received EOF from fd %i. "
+ "Closing fd and returning error.",
+ fd);
+ close (fd);
+ return (-1);
+ }
+
assert (nleft >= status);
nleft = nleft - status;
*
* DESCRIPTION
* Reads exactly `n' bytes or failes. Syntax and other behavior is analogous
- * to `read(2)'.
+ * to `read(2)'. If EOF is received the file descriptor is closed and an
+ * error is returned.
*
* PARAMETERS
* `fd' File descriptor to write to.