Re: Replace remaining getpwuid() calls with getpwuid_r()? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Replace remaining getpwuid() calls with getpwuid_r()?
Date
Msg-id 1466210.1752126519@sss.pgh.pa.us
Whole thread Raw
In response to Replace remaining getpwuid() calls with getpwuid_r()?  (Steve Lau <stevelauc@outlook.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: A recent message added to pg_upgade
Next
From: Japin Li
Date:
Subject: Re: [WIP]Vertical Clustered Index (columnar store extension) - take2