comparison cli-main.c @ 1697:789466c5956b

set up early logging name
author Matt Johnston <matt@ucc.asn.au>
date Thu, 28 May 2020 22:02:33 +0800
parents d5cdc60db08e
children d1b279aa5ed1
comparison
equal deleted inserted replaced
1696:d18fa38c1fd4 1697:789466c5956b
129 129
130 static void cli_dropbear_log(int priority, 130 static void cli_dropbear_log(int priority,
131 const char* format, va_list param) { 131 const char* format, va_list param) {
132 132
133 char printbuf[1024]; 133 char printbuf[1024];
134 const char *name;
135
136 name = cli_opts.progname;
137 if (!name) {
138 name = "dbclient";
139 }
134 140
135 vsnprintf(printbuf, sizeof(printbuf), format, param); 141 vsnprintf(printbuf, sizeof(printbuf), format, param);
136 142
137 #ifndef DISABLE_SYSLOG 143 #ifndef DISABLE_SYSLOG
138 if (opts.usingsyslog) { 144 if (opts.usingsyslog) {
139 syslog(priority, "%s", printbuf); 145 syslog(priority, "%s", printbuf);
140 } 146 }
141 #endif 147 #endif
142 148
143 fprintf(stderr, "%s: %s\n", cli_opts.progname, printbuf); 149 fprintf(stderr, "%s: %s\n", name, printbuf);
144 fflush(stderr); 150 fflush(stderr);
145 } 151 }
146 152
147 static void exec_proxy_cmd(const void *user_data_cmd) { 153 static void exec_proxy_cmd(const void *user_data_cmd) {
148 const char *cmd = user_data_cmd; 154 const char *cmd = user_data_cmd;