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

Commit8359ed8

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 parentf31c149 commit8359ed8

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
@@ -261,7 +261,11 @@ pqsecure_open_client(PGconn *conn)
261261

262262
#ifdefENABLE_THREAD_SAFETY
263263
if (pthread_mutex_lock(&ssl_config_mutex))
264-
return-1;
264+
{
265+
printfPQExpBuffer(&conn->errorMessage,
266+
libpq_gettext("unable to acquire mutex\n"));
267+
returnPGRES_POLLING_FAILED;
268+
}
265269
#endif
266270
/* Create a connection-specific SSL object */
267271
if (!(conn->ssl=SSL_new(SSL_context))||
@@ -1112,7 +1116,11 @@ initialize_SSL(PGconn *conn)
11121116
*/
11131117
#ifdefENABLE_THREAD_SAFETY
11141118
if (pthread_mutex_lock(&ssl_config_mutex))
1119+
{
1120+
printfPQExpBuffer(&conn->errorMessage,
1121+
libpq_gettext("unable to acquire mutex\n"));
11151122
return-1;
1123+
}
11161124
#endif
11171125
if (SSL_CTX_use_certificate_chain_file(SSL_context,fnbuf)!=1)
11181126
{
@@ -1326,7 +1334,11 @@ initialize_SSL(PGconn *conn)
13261334

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp