Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf019c02

Browse files
committed
Improve handling of pthread_mutex_lock error case
We should really be reporting a useful error along with returninga valid return code if pthread_mutex_lock() throws an error forsome reason. Add that and back-patch to 9.0 as the prior patch.Pointed out by Alvaro Herrera
1 parentf310163 commitf019c02

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎src/interfaces/libpq/fe-secure.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,11 @@ pqsecure_open_client(PGconn *conn)
262262

263263
#ifdefENABLE_THREAD_SAFETY
264264
if (pthread_mutex_lock(&ssl_config_mutex))
265-
return-1;
265+
{
266+
printfPQExpBuffer(&conn->errorMessage,
267+
libpq_gettext("unable to acquire mutex\n"));
268+
returnPGRES_POLLING_FAILED;
269+
}
266270
#endif
267271
/* Create a connection-specific SSL object */
268272
if (!(conn->ssl=SSL_new(SSL_context))||
@@ -1111,7 +1115,11 @@ initialize_SSL(PGconn *conn)
11111115
*/
11121116
#ifdefENABLE_THREAD_SAFETY
11131117
if (pthread_mutex_lock(&ssl_config_mutex))
1118+
{
1119+
printfPQExpBuffer(&conn->errorMessage,
1120+
libpq_gettext("unable to acquire mutex\n"));
11141121
return-1;
1122+
}
11151123
#endif
11161124
if (SSL_CTX_use_certificate_chain_file(SSL_context,fnbuf)!=1)
11171125
{
@@ -1325,7 +1333,11 @@ initialize_SSL(PGconn *conn)
13251333

13261334
#ifdefENABLE_THREAD_SAFETY
13271335
if (pthread_mutex_lock(&ssl_config_mutex))
1336+
{
1337+
printfPQExpBuffer(&conn->errorMessage,
1338+
libpq_gettext("unable to acquire mutex\n"));
13281339
return-1;
1340+
}
13291341
#endif
13301342
if (SSL_CTX_load_verify_locations(SSL_context,fnbuf,NULL)!=1)
13311343
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp