summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2017-01-23 08:40:45 +0000
committerbenno <benno@openbsd.org>2017-01-23 08:40:45 +0000
commitdb8e85af23e857a9840dc2b4366d94686f07fc9a (patch)
tree64f4ab64cf50d7bf4676e0aad12a210bf9998936
parentcopy log.c/h from bgpd. (diff)
downloadwireguard-openbsd-db8e85af23e857a9840dc2b4366d94686f07fc9a.tar.xz
wireguard-openbsd-db8e85af23e857a9840dc2b4366d94686f07fc9a.zip
copy log.c/h from bgpd.
ok claudio
-rw-r--r--usr.sbin/ospfd/log.c21
-rw-r--r--usr.sbin/ospfd/log.h6
2 files changed, 15 insertions, 12 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
diff --git a/usr.sbin/ospfd/log.h b/usr.sbin/ospfd/log.h
index 166a5c7ea9e..803a02707f4 100644
--- a/usr.sbin/ospfd/log.h
+++ b/usr.sbin/ospfd/log.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.h,v 1.8 2016/09/02 14:02:48 benno Exp $ */
+/* $OpenBSD: log.h,v 1.9 2017/01/23 08:40:45 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -38,8 +38,8 @@ void log_info(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void log_debug(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
-void fatal(const char *) __dead
- __attribute__((__format__ (printf, 1, 0)));
+void fatal(const char *, ...) __dead
+ __attribute__((__format__ (printf, 1, 2)));
void fatalx(const char *) __dead
__attribute__((__format__ (printf, 1, 0)));