Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108637090
D41359.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D41359.diff
View Options
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
@@ -412,11 +412,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 *);
@@ -488,20 +486,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)
{
@@ -2406,7 +2390,6 @@
parseconfigfile(FILE *cf, bool allow_includes)
{
FILE *cf2;
- struct filed *f;
struct dirent **ent;
char cline[LINE_MAX];
char host[MAXHOSTNAMELEN];
@@ -2533,10 +2516,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);
}
}
@@ -2544,21 +2524,14 @@
readconfigfile(const char *path)
{
FILE *cf;
- struct filed *f;
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);
+ cfline("*.ERR\t/dev/console", "*", "*", "*");
+ cfline("*.PANIC\t*", "*", "*", "*");
}
}
@@ -2903,7 +2876,7 @@
/*
* Crack a configuration file line
*/
-static struct filed *
+static void
cfline(const char *line, const char *prog, const char *host,
const char *pfilter)
{
@@ -3041,7 +3014,7 @@
"unknown priority name \"%s\"", buf);
logerror(ebuf);
free(f);
- return (NULL);
+ return;
}
}
if (!pri_cmp)
@@ -3072,7 +3045,7 @@
buf);
logerror(ebuf);
free(f);
- return (NULL);
+ return;
}
f->f_pmask[i >> 3] = pri;
f->f_pcmp[i >> 3] = pri_cmp;
@@ -3190,7 +3163,7 @@
f->f_type = F_USERS;
break;
}
- return (f);
+ STAILQ_INSERT_TAIL(&fhead, f, next);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 28, 12:47 AM (9 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16228890
Default Alt Text
D41359.diff (2 KB)
Attached To
Mode
D41359: syslogd: Remove addfile() and free up some memory
Attached
Detach File
Event Timeline
Log In to Comment