On Wed, 8 Mar 2000, Per Mildner wrote:
> /* [PM] changed from count < file_size to count <= file_size */
> if (0 < count && count <= file_size)
> result = xrealloc (result, count + 2); /* why waste the slack? */
Sorry, I don't understand this change. If the amount of data read from
the file is the same as we thought when we allocated the buffer, why do
we need to reallocate it? The call to xrealloc is only justified if you
read less, since that means your buffer wastes space.
The relevant context here is of DOS/Windows systems where reading a file
typically strips the CR characters from each line. For a large document
with lots of lines, you can end up wasting several tens of KBytes, which
is enough not to ignore it.
(Evidently, Cygwin reads the files in binary mode, so it doesn't belong
to the above class of systems. But in that case, it should behave like a
Unix box, where you always read the exact amount of bytes as returned by
the call to stat.)
So could you please explain the need for this change, and exactly how
does the current source cause Permission Denied because of this issue?