Re: Replace remaining getpwuid() calls with getpwuid_r()?

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: Replace remaining getpwuid() calls with getpwuid_r()?
Дата
Msg-id CA+hUKGLH_sDExwZ8dS3hg8J6ihQwS=4HLiQP+CADXhMBNvFDbg@mail.gmail.com
обсуждение исходный текст
Ответ на Replace remaining getpwuid() calls with getpwuid_r()?  (Steve Lau <stevelauc@outlook.com>)
Список pgsql-hackers
On Thu, Jul 10, 2025 at 5:10 PM Steve Lau <stevelauc@outlook.com> wrote:
> Hi hackers, when reading the source code, I noticed that Postgres is still using getpwuid(), which is not thread-safe
sinceit returns a pointer to the static memory that can be overwritten by concurrent calls. Then I searched "getpwuid"
inthe mailing list[1], and there was a committed patch that refactored one such usage. So maybe we can clean up the
remaininggetpwuid() calls? 

+1, we should.

> Then I realized that Postgres does not use threads but processes, so technically IMHO getpwuid() is safe to Postgres?
Butthat patch mentioned that[2]: 

We would like to use threads, and many things like this are being
changed currently.



В списке pgsql-hackers по дате отправления: