Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102061203
D41358.id125712.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.id125712.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,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) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 3:29 AM (18 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14526655
Default Alt Text
D41358.id125712.diff (1 KB)
Attached To
Mode
D41358: syslogd: Read configuration outside of init loop
Attached
Detach File
Event Timeline
Log In to Comment