1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Unix: Change debugging options

The old behavior was that enabling debugging did many nontrivial changes
in BIRD behavior. The patch changes it that these changes are generally
independent. Compiling with --enable-debug now just enables compile-time
debug macros, but do not automatically activate debug mode (-d) nor local
mode (-l). Debug mode with output to file (-D) do not force foreground
mode (-f), therefore there is no need for backgroud option (-b), which is
removed. Also fixes a bug when the default log target in -D mode was
stderr instead of given debug file.
This commit is contained in:
Ondrej Zajicek (work)
2018-12-04 16:55:25 +01:00
parent 0642fb4d45
commit 3fda08e405
5 changed files with 37 additions and 43 deletions

View File

@@ -44,12 +44,6 @@
* Debugging
*/
#ifdef DEBUGGING
static int debug_flag = 1;
#else
static int debug_flag = 0;
#endif
void
async_dump(void)
{
@@ -185,7 +179,7 @@ sysdep_preconfig(struct config *c)
int
sysdep_commit(struct config *new, struct config *old UNUSED)
{
log_switch(debug_flag, &new->logfiles, new->syslog_name);
log_switch(0, &new->logfiles, new->syslog_name);
return 0;
}
@@ -750,21 +744,16 @@ parse_args(int argc, char **argv)
while ((c = getopt(argc, argv, opt_list)) >= 0)
switch (c)
{
case 'b':
run_in_foreground = 0;
break;
case 'c':
config_name = optarg;
config_changed = 1;
break;
case 'd':
debug_flag |= 1;
log_init_debug("");
run_in_foreground = 1;
break;
case 'D':
log_init_debug(optarg);
debug_flag |= 2;
run_in_foreground = 1;
break;
case 'p':
parse_and_exit = 1;
@@ -822,9 +811,7 @@ main(int argc, char **argv)
#endif
parse_args(argc, argv);
if (debug_flag == 1)
log_init_debug("");
log_switch(debug_flag, NULL, NULL);
log_switch(1, NULL, NULL);
net_init();
resource_init();