iwj writes ("[PATCH] check return value from read() and write() properly"):
> The system calls read and write may return less than the whole amount
> requested for a number of reasons.  So the idioms
>    if (read(fd, &object, sizeof(object)) != sizeof(object)) goto fail;
> and even worse
>    if (read(fd, &object, sizeof(object)) < 0) goto fail;
> are wrong.  Additionally, read and write may sometimes return EINTR on
> some systems so interruption is not desired or expected a loop is
> needed.
> 
> In the attached patch I introduce two new pairs of functions:

I think this fix should be applied because it corrects bugs which
might conceivably data loss.

Thanks,
Ian.


Reply via email to