@@ -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
@@ -1114,10 +1118,12 @@ initialize_SSL(PGconn *conn)
1114
1118
* SSL_context struct.
1115
1119
*/
1116
1120
#ifdef ENABLE_THREAD_SAFETY
1117
- if (pthread_mutex_lock (& ssl_config_mutex ))
1121
+ int rc ;
1122
+
1123
+ if ((rc = pthread_mutex_lock (& ssl_config_mutex )))
1118
1124
{
1119
1125
printfPQExpBuffer (& conn -> errorMessage ,
1120
- libpq_gettext ("unable to acquire mutex\n" ));
1126
+ libpq_gettext ("could not acquire mutex: %s \n" ), strerror ( rc ));
1121
1127
return -1 ;
1122
1128
}
1123
1129
#endif
@@ -1332,10 +1338,12 @@ initialize_SSL(PGconn *conn)
1332
1338
X509_STORE * cvstore ;
1333
1339
1334
1340
#ifdef ENABLE_THREAD_SAFETY
1335
- if (pthread_mutex_lock (& ssl_config_mutex ))
1341
+ int rc ;
1342
+
1343
+ if ((rc = pthread_mutex_lock (& ssl_config_mutex )))
1336
1344
{
1337
1345
printfPQExpBuffer (& conn -> errorMessage ,
1338
- libpq_gettext ("unable to acquire mutex\n" ));
1346
+ libpq_gettext ("could not acquire mutex: %s \n" ), strerror ( rc ));
1339
1347
return -1 ;
1340
1348
}
1341
1349
#endif