@@ -257,14 +257,18 @@ pqsecure_open_client(PGconn *conn)
257
257
/* First time through? */
258
258
if (conn -> ssl == NULL )
259
259
{
260
+ #ifdef ENABLE_THREAD_SAFETY
261
+ int rc ;
262
+ #endif
263
+
260
264
/* We cannot use MSG_NOSIGNAL to block SIGPIPE when using SSL */
261
265
conn -> sigpipe_flag = false;
262
266
263
267
#ifdef ENABLE_THREAD_SAFETY
264
- if (pthread_mutex_lock (& ssl_config_mutex ))
268
+ if (( rc = pthread_mutex_lock (& ssl_config_mutex ) ))
265
269
{
266
270
printfPQExpBuffer (& conn -> errorMessage ,
267
- libpq_gettext ("unable to acquire mutex\n" ));
271
+ libpq_gettext ("could not acquire mutex: %s \n" ), strerror ( rc ));
268
272
return PGRES_POLLING_FAILED ;
269
273
}
270
274
#endif
@@ -1116,10 +1120,12 @@ initialize_SSL(PGconn *conn)
1116
1120
* SSL_context struct.
1117
1121
*/
1118
1122
#ifdef ENABLE_THREAD_SAFETY
1119
- if (pthread_mutex_lock (& ssl_config_mutex ))
1123
+ int rc ;
1124
+
1125
+ if ((rc = pthread_mutex_lock (& ssl_config_mutex )))
1120
1126
{
1121
1127
printfPQExpBuffer (& conn -> errorMessage ,
1122
- libpq_gettext ("unable to acquire mutex\n" ));
1128
+ libpq_gettext ("could not acquire mutex: %s \n" ), strerror ( rc ));
1123
1129
return -1 ;
1124
1130
}
1125
1131
#endif
@@ -1334,10 +1340,12 @@ initialize_SSL(PGconn *conn)
1334
1340
X509_STORE * cvstore ;
1335
1341
1336
1342
#ifdef ENABLE_THREAD_SAFETY
1337
- if (pthread_mutex_lock (& ssl_config_mutex ))
1343
+ int rc ;
1344
+
1345
+ if ((rc = pthread_mutex_lock (& ssl_config_mutex )))
1338
1346
{
1339
1347
printfPQExpBuffer (& conn -> errorMessage ,
1340
- libpq_gettext ("unable to acquire mutex\n" ));
1348
+ libpq_gettext ("could not acquire mutex: %s \n" ), strerror ( rc ));
1341
1349
return -1 ;
1342
1350
}
1343
1351
#endif
0 commit comments