diff 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
line wrap: on
line diff
--- a/cli-main.c	Thu May 28 22:02:03 2020 +0800
+++ b/cli-main.c	Thu May 28 22:02:33 2020 +0800
@@ -131,6 +131,12 @@
 		const char* format, va_list param) {
 
 	char printbuf[1024];
+	const char *name;
+
+	name = cli_opts.progname;
+	if (!name) {
+		name = "dbclient";
+	}
 
 	vsnprintf(printbuf, sizeof(printbuf), format, param);
 
@@ -140,7 +146,7 @@
 	}
 #endif
 
-	fprintf(stderr, "%s: %s\n", cli_opts.progname, printbuf);
+	fprintf(stderr, "%s: %s\n", name, printbuf);
 	fflush(stderr);
 }