diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-10-20 13:26:51 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-10-20 13:26:51 +0000 |
commit | 59343009af568a43bdd36606a866dfca734e0a56 (patch) | |
tree | 9dfc0c6a491553ef1d4ba9375ad24acffc1dd482 /usr.sbin/ospf6d | |
parent | f3c3058e17d6e7c0f6d0af5829d7f013c60dcd66 (diff) |
Sync parse.y with recent enhancements in hoststated.
Fix behavior when running -n.
henning@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.c | 9 | ||||
-rw-r--r-- | usr.sbin/ospf6d/parse.y | 8 |
2 files changed, 10 insertions, 7 deletions
diff --git a/usr.sbin/ospf6d/ospf6d.c b/usr.sbin/ospf6d/ospf6d.c index d79793a7c31..a2797779cd3 100644 --- a/usr.sbin/ospf6d/ospf6d.c +++ b/usr.sbin/ospf6d/ospf6d.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6d.c,v 1.5 2007/10/16 08:41:56 claudio Exp $ */ +/* $OpenBSD: ospf6d.c,v 1.6 2007/10/20 13:26:50 pyr Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -136,6 +136,8 @@ main(int argc, char *argv[]) conffile = CONF_FILE; ospfd_process = PROC_MAIN; + log_init(1); /* log to stderr until daemonized */ + while ((ch = getopt(argc, argv, "cdf:nv")) != -1) { switch (ch) { case 'c': @@ -162,9 +164,6 @@ main(int argc, char *argv[]) } } - /* start logging */ - log_init(debug); - mib[0] = CTL_NET; mib[1] = PF_INET6; mib[2] = IPPROTO_IPV6; @@ -202,6 +201,8 @@ main(int argc, char *argv[]) if (getpwnam(OSPF6D_USER) == NULL) errx(1, "unknown user %s", OSPF6D_USER); + log_init(debug); + if (!debug) daemon(1, 0); diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y index 867c8087ad6..c2ce0df8aa9 100644 --- a/usr.sbin/ospf6d/parse.y +++ b/usr.sbin/ospf6d/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.9 2007/10/16 20:01:23 mpf Exp $ */ +/* $OpenBSD: parse.y,v 1.10 2007/10/20 13:26:50 pyr Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -837,9 +837,12 @@ pushfile(const char *name, int secret) struct file *nfile; if ((nfile = calloc(1, sizeof(struct file))) == NULL || - (nfile->name = strdup(name)) == NULL) + (nfile->name = strdup(name)) == NULL) { + log_warn("malloc"); return (NULL); + } if ((nfile->stream = fopen(nfile->name, "r")) == NULL) { + log_warn("%s", nfile->name); free(nfile->name); free(nfile); return (NULL); @@ -897,7 +900,6 @@ parse_config(char *filename, int opts) conf->spf_state = SPF_IDLE; if ((file = pushfile(filename, !(conf->opts & OSPFD_OPT_NOACTION))) == NULL) { - warn("%s", filename); free(conf); return (NULL); } |