session CHANGE print caller in mutex lock fail
diff --git a/src/session.c b/src/session.c
index 97d561e..484e6b7 100644
--- a/src/session.c
+++ b/src/session.c
@@ -104,7 +104,7 @@
* -1 - error
*/
int
-nc_timedlock(pthread_mutex_t *lock, int timeout)
+nc_timedlock(pthread_mutex_t *lock, int timeout, const char *func)
{
int ret;
struct timespec ts_timeout;
@@ -127,7 +127,7 @@
return 0;
} else if (ret) {
/* error */
- ERR("Mutex lock failed (%s).", strerror(ret));
+ ERR("Mutex lock failed (%s, %s).", func, strerror(ret));
return -1;
}
@@ -294,7 +294,7 @@
}
if (session->ti_lock) {
- r = nc_timedlock(session->ti_lock, NC_READ_TIMEOUT * 1000);
+ r = nc_timedlock(session->ti_lock, NC_READ_TIMEOUT * 1000, __func__);
if (r == -1) {
return;
} else if (!r) {
diff --git a/src/session_client.c b/src/session_client.c
index de18c14..d35a800 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -462,7 +462,7 @@
struct nc_msg_cont *cont, **cont_ptr;
NC_MSG_TYPE msgtype = 0; /* NC_MSG_ERROR */
- r = nc_timedlock(session->ti_lock, timeout);
+ r = nc_timedlock(session->ti_lock, timeout, __func__);
if (r == -1) {
/* error */
return NC_MSG_ERROR;
@@ -1800,7 +1800,7 @@
return NC_MSG_ERROR;
}
- ret = nc_timedlock(session->ti_lock, timeout);
+ ret = nc_timedlock(session->ti_lock, timeout, __func__);
if (ret == -1) {
/* error */
r = NC_MSG_ERROR;
diff --git a/src/session_p.h b/src/session_p.h
index 53e1c16..34e08e4 100644
--- a/src/session_p.h
+++ b/src/session_p.h
@@ -300,7 +300,7 @@
#endif
int nc_gettimespec(struct timespec *ts);
-int nc_timedlock(pthread_mutex_t *lock, int timeout);
+int nc_timedlock(pthread_mutex_t *lock, int timeout, const char *func);
int nc_ps_lock(struct nc_pollsession *ps, uint8_t *id, const char *func);
diff --git a/src/session_server.c b/src/session_server.c
index bdd4430..ca89244 100755
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -1125,7 +1125,7 @@
}
/* reading an RPC and sending a reply must be atomic (no other RPC should be read) */
- ret = nc_timedlock(cur_session->ti_lock, timeout);
+ ret = nc_timedlock(cur_session->ti_lock, timeout, __func__);
if (ret < 0) {
ret = NC_PSPOLL_ERROR;
goto finish;
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index ff90ad0..61bd779 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -932,7 +932,7 @@
return -1;
}
- ret = nc_timedlock(session->ti_lock, timeout);
+ ret = nc_timedlock(session->ti_lock, timeout, __func__);
if (ret != 1) {
return ret;
}
@@ -974,7 +974,7 @@
return -1;
}
- ret = nc_timedlock(session->ti_lock, timeout);
+ ret = nc_timedlock(session->ti_lock, timeout, __func__);
if (ret != 1) {
return ret;
}
@@ -1012,7 +1012,7 @@
int ret;
struct nc_session *new;
- ret = nc_timedlock(session->ti_lock, timeout);
+ ret = nc_timedlock(session->ti_lock, timeout, __func__);
if (ret < 0) {
return NC_PSPOLL_ERROR;