changeset 1697:789466c5956b

set up early logging name
author Matt Johnston <matt@ucc.asn.au>
date Thu, 28 May 2020 22:02:33 +0800
parents d18fa38c1fd4
children f966834f0f9c
files cli-main.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
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);
 }