- size_t nbytes_to_read = count;
- ssize_t result;
-
- /* Limit the number of bytes to read, to avoid running into unspecified
- behaviour. But keep the file pointer block aligned when doing so.
- Note that in this case we don't need to call read() multiple times here,
- because the caller is prepared to partial results. */
- if (nbytes_to_read > MAX_BYTES_TO_READ)
- nbytes_to_read = MAX_BYTES_TO_READ & ~8191;
+ /* Work around a bug in Tru64 5.1. Attempting to read more than
+ INT_MAX bytes fails with errno == EINVAL. See
+ <http://lists.gnu.org/archive/html/bug-gnu-utils/2002-04/msg00010.html>.
+ When decreasing COUNT, keep it block-aligned. */
+ enum { BUGGY_READ_MAXIMUM = INT_MAX & ~8191 };