summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/log.c
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2017-01-23 08:41:03 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2017-01-23 08:41:03 +0000
commitaaf4acc81559f4d4f236103fc2dc549d893b06f3 (patch)
tree7d605b0fa60a6ca53e2749d0c038c1f46934080a /usr.sbin/ospfd/log.c
parent1725dd6539ca8b8bac4d5c74ca744cc200f880d9 (diff)
copy log.c/h from bgpd.
ok claudio
Diffstat (limited to 'usr.sbin/ospfd/log.c')
-rw-r--r--usr.sbin/ospfd/log.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/usr.sbin/ospfd/log.c b/usr.sbin/ospfd/log.c
index 48d344ffb43..711a62f0b91 100644
--- a/usr.sbin/ospfd/log.c
+++ b/usr.sbin/ospfd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.9 2016/09/02 14:02:48 benno Exp $ */
+/* $OpenBSD: log.c,v 1.10 2017/01/23 08:40:45 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -23,7 +23,6 @@
#include <string.h>
#include <syslog.h>
#include <time.h>
-#include <unistd.h>
#include "log.h"
#include "ospfd.h"
@@ -137,23 +136,27 @@ log_debug(const char *emsg, ...)
}
void
-fatal(const char *emsg)
+fatal(const char *emsg, ...)
{
+ char s[1024];
+ va_list ap;
+
+ va_start(ap, emsg);
+ vsnprintf(s, sizeof(s), emsg, ap);
+ va_end(ap);
+
if (emsg == NULL)
logit(LOG_CRIT, "fatal in %s: %s", log_procname,
strerror(errno));
else
if (errno)
logit(LOG_CRIT, "fatal in %s: %s: %s",
- log_procname, emsg, strerror(errno));
+ log_procname, s, strerror(errno));
else
logit(LOG_CRIT, "fatal in %s: %s",
- log_procname, emsg);
+ log_procname, s);
- if (ospfd_process == PROC_MAIN)
- exit(1);
- else /* parent copes via SIGCHLD */
- _exit(1);
+ exit(1);
}
void