summaryrefslogtreecommitdiffstats
path: root/sysdep
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-06-09 09:32:57 +0200
committerMartin Mares <mj@ucw.cz>2000-06-09 09:32:57 +0200
commit5ddf4a58f9c4173acefa1df92ccd3da90230a863 (patch)
tree43cb4a1b565c3d5edc9727f0e49bf5a24541fa5b /sysdep
parent0b3bf4b1d898b4e438fe4959a63fc16211baff12 (diff)
downloadbird-5ddf4a58f9c4173acefa1df92ccd3da90230a863.tar
bird-5ddf4a58f9c4173acefa1df92ccd3da90230a863.zip
During initialization, log to both syslog and stderr. When a configuration
file has been read and it doesn't specify any logging, log to syslog only (if syslog is not available, then stderr).
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/unix/log.c6
-rw-r--r--sysdep/unix/main.c2
-rw-r--r--sysdep/unix/unix.h2
3 files changed, 6 insertions, 4 deletions
diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c
index b13c941..cc15ff3 100644
--- a/sysdep/unix/log.c
+++ b/sysdep/unix/log.c
@@ -184,7 +184,7 @@ debug(char *msg, ...)
}
void
-log_init(int debug)
+log_init(int debug, int init)
{
static struct log_config lc_stderr = { mask: ~0, terminal_flag: 1 };
@@ -197,6 +197,8 @@ log_init(int debug)
static struct log_config lc_syslog = { mask: ~0 };
openlog("bird", LOG_CONS | LOG_NDELAY, LOG_DAEMON);
add_tail(current_log_list, &lc_syslog.n);
+ if (!init)
+ return;
}
#endif
@@ -208,7 +210,7 @@ void
log_switch(list *l)
{
if (EMPTY_LIST(*l))
- current_log_list = &init_log_list;
+ log_init(0, 0);
else
current_log_list = l;
}
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index fed833b..e0e3ca9 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -408,7 +408,7 @@ main(int argc, char **argv)
parse_args(argc, argv);
if (debug_flag == 1)
log_init_debug("");
- log_init(debug_flag);
+ log_init(debug_flag, 1);
DBG("Initializing.\n");
resource_init();
diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h
index 68850bc..5da925c 100644
--- a/sysdep/unix/unix.h
+++ b/sysdep/unix/unix.h
@@ -49,7 +49,7 @@ void krt_io_init(void);
/* log.c */
-void log_init(int debug);
+void log_init(int debug, int init);
void log_init_debug(char *); /* Initialize debug dump to given file (NULL=stderr, ""=off) */
void log_switch(struct list *);