From be467afaffc7bf0034a4de2dc874484481d920b9 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Tue, 14 Nov 1995 23:39:39 +0000 Subject: [PATCH] With the recent 'make install' change in the kernel build makefiles, an `interesting' feature of syslogd turned up. It calls getbootfile() for each log entry. Since the kernel makefile now changes kern.bootfile when doing a 'make install', it's quite startling to see the syslog lines change. This change makes it call getbootfile() once at startup and cache it, saving a syscall per loop, and keeping something a little more asthetically pleasing in /var/log/messages... --- usr.sbin/syslogd/syslogd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 355c9f1c6c0..ebf1bc4372a 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -39,7 +39,7 @@ static const char copyright[] = static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; */ static const char rcsid[] = - "$Id$"; + "$Id: syslogd.c,v 1.7 1995/10/12 17:18:39 wollman Exp $"; #endif /* not lint */ /* @@ -192,6 +192,7 @@ int Initialized = 0; /* set when we have initialized ourselves */ int MarkInterval = 20 * 60; /* interval between marks in seconds */ int MarkSeq = 0; /* mark sequence number */ int created_lsock = 0; /* Flag if local socket created */ +char bootfile[MAXLINE+1]; /* booted kernel file */ void cfline __P((char *, struct filed *, char *)); char *cvthname __P((struct sockaddr_in *)); @@ -259,6 +260,7 @@ main(argc, argv) LocalDomain = p; } else LocalDomain = ""; + (void)strcpy(bootfile, getbootfile()); (void)signal(SIGTERM, die); (void)signal(SIGINT, Debug ? die : SIG_IGN); (void)signal(SIGQUIT, Debug ? die : SIG_IGN); @@ -442,7 +444,7 @@ printsys(msg) int c, pri, flags; char *lp, *p, *q, line[MAXLINE + 1]; - (void)strcpy(line, getbootfile()); + (void)strcpy(line, bootfile); (void)strcat(line, ": "); lp = line + strlen(line); for (p = msg; *p != '\0'; ) {