mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-27 19:17:19 +02:00
Fix unsafe usage of strerror(errno) within ereport().
This is the converse of the unsafe-usage-of-%m problem: the reason ereport/elog provide that format code is mainly to dodge the hazard of errno getting changed before control reaches functions within the arguments of the macro. I only found one instance of this hazard, but it's been there since 9.4 :-(.
This commit is contained in:
parent
9c515f77d6
commit
1545ca9a74
@ -1752,10 +1752,12 @@ auth_peer(hbaPort *port)
|
||||
pw = getpwuid(uid);
|
||||
if (!pw)
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("could not look up local user ID %ld: %s",
|
||||
(long) uid,
|
||||
errno ? strerror(errno) : _("user does not exist"))));
|
||||
save_errno ? strerror(save_errno) : _("user does not exist"))));
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user