Re: clean up size_t/ssize_t use with POSIX file system APIs

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: clean up size_t/ssize_t use with POSIX file system APIs
Date: 2026-07-16 09:30:41
Message-ID: 0db5d34c-b32f-431f-b5ac-fd64417a6d88@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-07-16 09:41:55 RE: Follow-up fixes for online wal_level change
Previous Message Akshay Joshi 2026-07-16 09:30:28 Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements