]> granicus.if.org Git - curl/commitdiff
libssh: include line number in state change debug messages
authorDaniel Stenberg <daniel@haxx.se>
Thu, 5 Jul 2018 20:43:29 +0000 (22:43 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 6 Jul 2018 07:11:20 +0000 (09:11 +0200)
Closes #2713

lib/ssh-libssh.c

index 69c87ac67638edd49fdf79979b4866728d179154..1c00879bad13fd20ac26758eab5c45875399a9cf 100644 (file)
@@ -204,11 +204,21 @@ static CURLcode sftp_error_to_CURLE(int err)
   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
  */
 /* 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;
 #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
@@ -278,8 +288,9 @@ static void state(struct connectdata *conn, sshstate nowstate)
 
 
   if(sshc->state != nowstate) {
-    infof(conn->data, "SSH %p state change from %s to %s\n",
-          (void *) sshc, names[sshc->state], names[nowstate]);
+    infof(conn->data, "SSH %p state change from %s to %s (line %d)\n",
+          (void *) sshc, names[sshc->state], names[nowstate],
+          lineno);
   }
 #endif