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 @@ -414,11 +414,9 @@ struct iovlist; static int allowaddr(char *); -static int addfile(struct filed *); static int addpeer(struct peer *); static int addsock(struct addrinfo *, struct socklist *); -static struct filed *cfline(const char *, const char *, const char *, - const char *); +static void cfline(const char *, const char *, const char *, const char *); static const char *cvthname(struct sockaddr *); static void deadq_enter(pid_t, const char *); static int deadq_remove(struct deadq_entry *); @@ -490,20 +488,6 @@ f->f_file = -1; } -static int -addfile(struct filed *f0) -{ - struct filed *f; - - f = calloc(1, sizeof(*f)); - if (f == NULL) - err(1, "malloc failed"); - *f = *f0; - STAILQ_INSERT_TAIL(&fhead, f, next); - - return (0); -} - static int addpeer(struct peer *pe0) { @@ -2408,7 +2392,6 @@ parseconfigfile(FILE *cf, bool allow_includes) { FILE *cf2; - struct filed *f; struct dirent **ent; char cline[LINE_MAX]; char host[MAXHOSTNAMELEN]; @@ -2535,10 +2518,7 @@ } for (i = strlen(cline) - 1; i >= 0 && isspace(cline[i]); i--) cline[i] = '\0'; - f = cfline(cline, prog, host, pfilter); - if (f != NULL) - addfile(f); - free(f); + cfline(cline, prog, host, pfilter); } } @@ -2546,7 +2526,6 @@ readconfigfile(const char *path) { FILE *cf; - struct filed *f; /* open the configuration file */ if ((cf = fopen(path, "r")) != NULL) { @@ -2554,14 +2533,8 @@ (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); + cfline("*.ERR\t/dev/console", "*", "*", "*"); + cfline("*.PANIC\t*", "*", "*", "*"); } } @@ -2906,7 +2879,7 @@ /* * Crack a configuration file line */ -static struct filed * +static void cfline(const char *line, const char *prog, const char *host, const char *pfilter) { @@ -3044,7 +3017,7 @@ "unknown priority name \"%s\"", buf); logerror(ebuf); free(f); - return (NULL); + return; } } if (!pri_cmp) @@ -3075,7 +3048,7 @@ buf); logerror(ebuf); free(f); - return (NULL); + return; } f->f_pmask[i >> 3] = pri; f->f_pcmp[i >> 3] = pri_cmp; @@ -3193,7 +3166,7 @@ f->f_type = F_USERS; break; } - return (f); + STAILQ_INSERT_TAIL(&fhead, f, next); }