On 06.07.26 14:38, Heikki Linnakangas wrote:
Should probably change the 'i' into size_t as well, since it's compared
with 'nread'. And 'nlines' too, to be pendantic, so that it doesn't
overflow if you have a 10 GB file full of newlines..
As a sanity check though, it'd probably make sense to check that the
file is not larger than a few kB or so. This is used to read the pid
file and postmaster.opts file, neither of which is expected to be large.
This patch set has been committed.
I changed the type of 'i' to match nread. The other changes I attempted
but they would have crept into more and more places, so I stopped. We
can keep that for a separate small project. I suspect similar
treatments might be appropriate elsewhere, too.