mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Incorporate strerror_r() into src/port/snprintf.c, too.
This provides the features that used to exist in useful_strerror() for users of strerror_r(), too. Also, standardize on the GNU convention that strerror_r returns a char pointer that may not be NULL. I notice that libpq's win32.c contains a variant version of strerror_r that probably ought to be folded into strerror.c. But lacking a Windows environment, I should leave that to somebody else. Discussion: https://postgr.es/m/2975.1526862605@sss.pgh.pa.us
This commit is contained in:
@ -756,11 +756,11 @@ pg_local_sendauth(PGconn *conn)
|
||||
|
||||
if (sendmsg(conn->sock, &msg, 0) == -1)
|
||||
{
|
||||
char sebuf[256];
|
||||
char sebuf[PG_STRERROR_R_BUFLEN];
|
||||
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
"pg_local_sendauth: sendmsg: %s\n",
|
||||
pqStrerror(errno, sebuf, sizeof(sebuf)));
|
||||
strerror_r(errno, sebuf, sizeof(sebuf)));
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
return STATUS_OK;
|
||||
@ -1098,7 +1098,7 @@ pg_fe_getauthname(PQExpBuffer errorMessage)
|
||||
printfPQExpBuffer(errorMessage,
|
||||
libpq_gettext("could not look up local user ID %d: %s\n"),
|
||||
(int) user_id,
|
||||
pqStrerror(pwerr, pwdbuf, sizeof(pwdbuf)));
|
||||
strerror_r(pwerr, pwdbuf, sizeof(pwdbuf)));
|
||||
else
|
||||
printfPQExpBuffer(errorMessage,
|
||||
libpq_gettext("local user with ID %d does not exist\n"),
|
||||
|
Reference in New Issue
Block a user