Kevin Fox <[email protected]> ha escrit:

> Thats not how I read that function:
> size_t safe_rw (int fd, void const *buf, size_t count)
> {
>   enum { BUGGY_READ_MAXIMUM = INT_MAX & ~8191 };
>   for (;;)
>     {
>       ssize_t result = rw (fd, buf, count);
>       if (0 <= result)
>         return result;
>
> short read, return right away without looping. I don't believe tar

You seem to confuse "short reads" with "interrupted reads".  A "short
read" is when read returns less bytes than requested.  No signals are
delivered it this case.  An "interrupted read" occurs when a signal is
delivered while read is in progress.  In that case read returns -1 and
sets errno to EINTR.  That's exactly what this function is designed to
handle.

Regards,
Sergey

Reply via email to