diff dbutil.c @ 731:9a5438271556

Move the more verbose TRACE() statements into TRACE2()
author Matt Johnston <matt@ucc.asn.au>
date Mon, 01 Apr 2013 00:07:26 +0800
parents fc7ae88e63b3
children d63ef1e211ea
line wrap: on
line diff
--- a/dbutil.c	Sun Mar 31 23:48:25 2013 +0800
+++ b/dbutil.c	Mon Apr 01 00:07:26 2013 +0800
@@ -151,6 +151,20 @@
 	fprintf(stderr, "\n");
 	va_end(param);
 }
+void dropbear_trace2(const char* format, ...) {
+
+	va_list param;
+
+	if (!(debug_trace && getenv("DROPBEAR_TRACE2"))) {
+		return;
+	}
+
+	va_start(param, format);
+	fprintf(stderr, "TRACE2 (%d): ", getpid());
+	vfprintf(stderr, format, param);
+	fprintf(stderr, "\n");
+	va_end(param);
+}
 #endif /* DEBUG_TRACE */
 
 static void set_sock_priority(int sock) {
@@ -725,7 +739,7 @@
 
 	int c = EOF;
 
-	TRACE(("enter buf_getline"))
+	TRACE2(("enter buf_getline"))
 
 	buf_setpos(line, 0);
 	buf_setlen(line, 0);
@@ -750,10 +764,10 @@
 
 	/* if we didn't read anything before EOF or error, exit */
 	if (c == EOF && line->pos == 0) {
-		TRACE(("leave buf_getline: failure"))
+		TRACE2(("leave buf_getline: failure"))
 		return DROPBEAR_FAILURE;
 	} else {
-		TRACE(("leave buf_getline: success"))
+		TRACE2(("leave buf_getline: success"))
 		buf_setpos(line, 0);
 		return DROPBEAR_SUCCESS;
 	}