libssh: include line number in state change debug messages

Closes #2713
This commit is contained in:
Daniel Stenberg 2018-07-05 22:43:29 +02:00
parent 75105480dc
commit 0d3eeaadb4
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -204,11 +204,21 @@ static CURLcode sftp_error_to_CURLE(int err)
return CURLE_SSH; return CURLE_SSH;
} }
#ifndef DEBUGBUILD
#define state(x,y) mystate(x,y)
#else
#define state(x,y) mystate(x,y, __LINE__)
#endif
/* /*
* SSH State machine related code * SSH State machine related code
*/ */
/* This is the ONLY way to change SSH state! */ /* This is the ONLY way to change SSH state! */
static void state(struct connectdata *conn, sshstate nowstate) static void mystate(struct connectdata *conn, sshstate nowstate
#ifdef DEBUGBUILD
, int lineno
#endif
)
{ {
struct ssh_conn *sshc = &conn->proto.sshc; struct ssh_conn *sshc = &conn->proto.sshc;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
@ -278,8 +288,9 @@ static void state(struct connectdata *conn, sshstate nowstate)
if(sshc->state != nowstate) { if(sshc->state != nowstate) {
infof(conn->data, "SSH %p state change from %s to %s\n", infof(conn->data, "SSH %p state change from %s to %s (line %d)\n",
(void *) sshc, names[sshc->state], names[nowstate]); (void *) sshc, names[sshc->state], names[nowstate],
lineno);
} }
#endif #endif