diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -2405,7 +2405,7 @@ } static void -readconfigfile(FILE *cf, int allow_includes) +parseconfigfile(FILE *cf, bool allow_includes) { FILE *cf2; struct filed *f; @@ -2466,8 +2466,8 @@ if (cf2 == NULL) continue; dprintf("reading %s\n", file); - readconfigfile(cf2, 0); - fclose(cf2); + parseconfigfile(cf2, true); + (void)fclose(cf2); } free(ent); continue; @@ -2542,6 +2542,29 @@ } } +static void +readconfigfile(const char *path) +{ + FILE *cf; + struct filed *f; + + /* open the configuration file */ + if ((cf = fopen(path, "r")) != NULL) { + parseconfigfile(cf, true); + (void)fclose(cf); + } else { + dprintf("cannot open %s\n", ConfFile); + f = cfline("*.ERR\t/dev/console", "*", "*", "*"); + if (f != NULL) + addfile(f); + free(f); + f = cfline("*.PANIC\t*", "*", "*", "*"); + if (f != NULL) + addfile(f); + free(f); + } +} + static void sighandler(int signo) { @@ -2557,7 +2580,6 @@ init(int signo) { int i; - FILE *cf; struct filed *f; char *p; char oldLocalHostName[MAXHOSTNAMELEN]; @@ -2648,27 +2670,7 @@ free(f); } - /* open the configuration file */ - if ((cf = fopen(ConfFile, "r")) == NULL) { - dprintf("cannot open %s\n", ConfFile); - f = cfline("*.ERR\t/dev/console", "*", "*", "*"); - if (f != NULL) - addfile(f); - free(f); - f = cfline("*.PANIC\t*", "*", "*", "*"); - if (f != NULL) - addfile(f); - free(f); - Initialized = 1; - - return; - } - - readconfigfile(cf, 1); - - /* close the configuration file */ - (void)fclose(cf); - + readconfigfile(ConfFile); Initialized = 1; if (Debug) {