On 2011/08/20 10:07, Stuart Henderson wrote:
> On 2011/08/17 22:29, Claudio Jeker wrote:
> > I don't like it and the diff is wrong -- the parent process will still not
> > log verbose. I think the problem should be fixed at the source and
> > change the way log_init() and log_verbose() work. Currently the second
> > log_init() call in ospfd.c will disable the verbose setting. I guess
> > log_init needs either 2 flags or it must only or n_debug into verbose so
> > that the previous call to log_verbose() is sticky.
>
> If we or n_debug into verbose, the log_init(1) for verbose logging
> at startup will never get cleared, so we will always log the debug
> information. So I think we need to add an argument to log_init().
on reflection I think this method is cleaner..
(sorry for the spam)
diff --git log.c log.c
index e8326b8..4a4300d 100644
--- log.c
+++ log.c
@@ -44,7 +44,6 @@ log_init(int n_debug)
extern char *__progname;
debug = n_debug;
- verbose = n_debug;
if (!debug)
openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON);
diff --git ospfd.c ospfd.c
index bcead83..1c235b3 100644
--- ospfd.c
+++ ospfd.c
@@ -139,6 +139,7 @@ main(int argc, char *argv[])
sockname = OSPFD_SOCKET;
log_init(1); /* log to stderr until daemonized */
+ log_verbose(1);
while ((ch = getopt(argc, argv, "cdD:f:ns:v")) != -1) {
switch (ch) {
@@ -166,7 +167,6 @@ main(int argc, char *argv[])
if (opts & OSPFD_OPT_VERBOSE)
opts |= OSPFD_OPT_VERBOSE2;
opts |= OSPFD_OPT_VERBOSE;
- log_verbose(1);
break;
default:
usage();
@@ -222,6 +222,7 @@ main(int argc, char *argv[])
errx(1, "unknown user %s", OSPFD_USER);
log_init(debug);
+ log_verbose(ospfd_conf->opts & OSPFD_OPT_VERBOSE);
if (!debug)
daemon(1, 0);