From 83e599faab7a8df2d1b8f14e305e1792c20205fd Mon Sep 17 00:00:00 2001 From: John Kohl Date: Sat, 25 Jun 1988 13:15:48 +0000 Subject: only format version once --- zhm/zhm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'zhm/zhm.c') diff --git a/zhm/zhm.c b/zhm/zhm.c index d0c6cc5..3d00cd1 100644 --- a/zhm/zhm.c +++ b/zhm/zhm.c @@ -409,6 +409,8 @@ int set_sig_type(sig) return(0); } +static char version[BUFSIZ] = ""; + send_stats(notice, sin) ZNotice_t *notice; struct sockaddr_in *sin; @@ -418,7 +420,6 @@ send_stats(notice, sin) char *bfr; char *list[20]; int len, i, nitems = 10; - char version[BUFSIZ]; newnotice = *notice; @@ -455,8 +456,9 @@ send_stats(notice, sin) /* Since ZFormatRaw* won't change the version number on notices, we need to set the version number explicitly. This code is taken from Zinternal.c, function Z_FormatHeader */ - (void) sprintf(version, "%s%d.%d", ZVERSIONHDR, ZVERSIONMAJOR, - ZVERSIONMINOR); + if (!*version) + (void) sprintf(version, "%s%d.%d", ZVERSIONHDR, ZVERSIONMAJOR, + ZVERSIONMINOR); newnotice.z_version = version; if ((ret = ZFormatRawNoticeList(&newnotice, list, nitems, &bfr, -- cgit v1.2.3