Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102061534
D41358.id125827.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41358.id125827.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
@@ -2405,7 +2405,7 @@
}
static void
-readconfigfile(FILE *cf, int allow_includes)
+parseconfigfile(FILE *cf, bool allow_includes)
{
FILE *cf2;
struct filed *f;
@@ -2466,7 +2466,7 @@
if (cf2 == NULL)
continue;
dprintf("reading %s\n", file);
- readconfigfile(cf2, 0);
+ parseconfigfile(cf2, false);
fclose(cf2);
}
free(ent);
@@ -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) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 3:34 AM (18 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14526802
Default Alt Text
D41358.id125827.diff (1 KB)
Attached To
Mode
D41358: syslogd: Read configuration outside of init loop
Attached
Detach File
Event Timeline
Log In to Comment