diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2017-01-23 08:41:03 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2017-01-23 08:41:03 +0000 |
commit | aaf4acc81559f4d4f236103fc2dc549d893b06f3 (patch) | |
tree | 7d605b0fa60a6ca53e2749d0c038c1f46934080a /usr.sbin/ospf6d | |
parent | 1725dd6539ca8b8bac4d5c74ca744cc200f880d9 (diff) |
copy log.c/h from bgpd.
ok claudio
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/log.c | 22 | ||||
-rw-r--r-- | usr.sbin/ospf6d/log.h | 6 |
2 files changed, 15 insertions, 13 deletions
diff --git a/usr.sbin/ospf6d/log.c b/usr.sbin/ospf6d/log.c index 17fb38e74a5..1b2d737b38f 100644 --- a/usr.sbin/ospf6d/log.c +++ b/usr.sbin/ospf6d/log.c @@ -1,7 +1,6 @@ -/* $OpenBSD: log.c,v 1.12 2016/09/02 14:06:35 benno Exp $ */ +/* $OpenBSD: log.c,v 1.13 2017/01/23 08:41:02 benno Exp $ */ /* - * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any @@ -24,7 +23,6 @@ #include <string.h> #include <syslog.h> #include <time.h> -#include <unistd.h> #include "log.h" #include "ospf6d.h" @@ -138,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/ospf6d/log.h b/usr.sbin/ospf6d/log.h index 580fb608df4..1745e8282d0 100644 --- a/usr.sbin/ospf6d/log.h +++ b/usr.sbin/ospf6d/log.h @@ -1,4 +1,4 @@ -/* $OpenBSD: log.h,v 1.10 2016/09/02 14:06:35 benno Exp $ */ +/* $OpenBSD: log.h,v 1.11 2017/01/23 08:41:02 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))); |