Steve Lau <stevelauc@outlook.com> writes:
> 1. Will the thread-safety issue of getpwuid() affect Postgres? Why?
You have to pay attention to context. AFAICS the two extant calls
to getpwuid() are in
1. psql's exec_command_cd(). psql is not multithreaded and I'd
be surprised if there is a reason to make it so.
2. src/common/username.c's get_user_name(). This might be
problematic, but looking at the current usages I very much
doubt it. Most callers are non-multithreaded src/bin/ programs,
and the one server-side call is in single-user-mode startup,
and on top of that the call is only for geteuid() which will
not change within a given process anyway.
As Thomas mentioned, we are interested in converting the server
to multithreaded operation. But this quick survey does not
suggest that getpwuid() needs to be high on the list of things
to fix.
regards, tom lane