Adjust the ${ISODIR}/.didbootstrap logic a little, add needed licenses.
[dragonfly.git] / contrib / tcp_wrappers / diag.c
blobf9b5c94ac81a8e56874da1539cdeacb360b23ebd
1 /*
2 * Routines to report various classes of problems. Each report is decorated
3 * with the current context (file name and line number), if available.
4 *
5 * tcpd_warn() reports a problem and proceeds.
6 *
7 * tcpd_jump() reports a problem and jumps.
8 *
9 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
11 * @(#) diag.c 1.1 94/12/28 17:42:20
12 * $DragonFly: src/contrib/tcp_wrappers/diag.c,v 1.2 2005/09/15 04:33:04 sephe Exp $
15 /* System libraries */
17 #include <syslog.h>
18 #include <setjmp.h>
19 #include <stdarg.h>
21 /* Local stuff */
23 #include "tcpd.h"
25 struct tcpd_context tcpd_context;
26 jmp_buf tcpd_buf;
28 /* tcpd_diag - centralize error reporter */
30 static void
31 tcpd_diag(int severity, const char *tag, const char *format, va_list ap)
33 char fmt[BUFSIZ];
35 if (tcpd_context.file)
36 sprintf(fmt, "%s: %s, line %d: %s",
37 tag, tcpd_context.file, tcpd_context.line, format);
38 else
39 sprintf(fmt, "%s: %s", tag, format);
40 vsyslog(severity, fmt, ap);
43 /* tcpd_warn - report problem of some sort and proceed */
45 void
46 tcpd_warn(const char *format, ...)
48 va_list ap;
50 va_start(ap, format);
51 tcpd_diag(LOG_ERR, "warning", format, ap);
52 va_end(ap);
55 /* tcpd_jump - report serious problem and jump */
57 void
58 tcpd_jump(const char *format, ...)
60 va_list ap;
62 va_start(ap, format);
63 tcpd_diag(LOG_ERR, "error", format, ap);
64 va_end(ap);
65 longjmp(tcpd_buf, AC_ERROR);