comparison 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
comparison
equal deleted inserted replaced
730:714b9106e335 731:9a5438271556
149 fprintf(stderr, "TRACE (%d): ", getpid()); 149 fprintf(stderr, "TRACE (%d): ", getpid());
150 vfprintf(stderr, format, param); 150 vfprintf(stderr, format, param);
151 fprintf(stderr, "\n"); 151 fprintf(stderr, "\n");
152 va_end(param); 152 va_end(param);
153 } 153 }
154 void dropbear_trace2(const char* format, ...) {
155
156 va_list param;
157
158 if (!(debug_trace && getenv("DROPBEAR_TRACE2"))) {
159 return;
160 }
161
162 va_start(param, format);
163 fprintf(stderr, "TRACE2 (%d): ", getpid());
164 vfprintf(stderr, format, param);
165 fprintf(stderr, "\n");
166 va_end(param);
167 }
154 #endif /* DEBUG_TRACE */ 168 #endif /* DEBUG_TRACE */
155 169
156 static void set_sock_priority(int sock) { 170 static void set_sock_priority(int sock) {
157 171
158 int val; 172 int val;
723 #if defined(DROPBEAR_CLIENT) || defined(ENABLE_SVR_PUBKEY_AUTH) 737 #if defined(DROPBEAR_CLIENT) || defined(ENABLE_SVR_PUBKEY_AUTH)
724 int buf_getline(buffer * line, FILE * authfile) { 738 int buf_getline(buffer * line, FILE * authfile) {
725 739
726 int c = EOF; 740 int c = EOF;
727 741
728 TRACE(("enter buf_getline")) 742 TRACE2(("enter buf_getline"))
729 743
730 buf_setpos(line, 0); 744 buf_setpos(line, 0);
731 buf_setlen(line, 0); 745 buf_setlen(line, 0);
732 746
733 while (line->pos < line->size) { 747 while (line->pos < line->size) {
748 out: 762 out:
749 763
750 764
751 /* if we didn't read anything before EOF or error, exit */ 765 /* if we didn't read anything before EOF or error, exit */
752 if (c == EOF && line->pos == 0) { 766 if (c == EOF && line->pos == 0) {
753 TRACE(("leave buf_getline: failure")) 767 TRACE2(("leave buf_getline: failure"))
754 return DROPBEAR_FAILURE; 768 return DROPBEAR_FAILURE;
755 } else { 769 } else {
756 TRACE(("leave buf_getline: success")) 770 TRACE2(("leave buf_getline: success"))
757 buf_setpos(line, 0); 771 buf_setpos(line, 0);
758 return DROPBEAR_SUCCESS; 772 return DROPBEAR_SUCCESS;
759 } 773 }
760 774
761 } 775 }