version 1.8.50.2, 2012/04/23 23:40:41 |
version 1.9, 2012/03/21 10:10:37 |
Line 23 __RCSID("$NetBSD$"); |
|
Line 23 __RCSID("$NetBSD$"); |
|
/* System libraries */ |
/* System libraries */ |
|
|
#include <syslog.h> |
#include <syslog.h> |
|
#include <stdarg.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <setjmp.h> |
#include <setjmp.h> |
#include <string.h> |
#include <string.h> |
Line 31 __RCSID("$NetBSD$"); |
|
Line 32 __RCSID("$NetBSD$"); |
|
/* Local stuff */ |
/* Local stuff */ |
|
|
#include "tcpd.h" |
#include "tcpd.h" |
#include "mystdarg.h" |
|
|
|
struct tcpd_context tcpd_context; |
struct tcpd_context tcpd_context; |
jmp_buf tcpd_buf; |
jmp_buf tcpd_buf; |
|
|
static void tcpd_diag __P((int, char *, char *, va_list)) |
static void tcpd_diag(int, const char *, const char *, va_list) |
__attribute__((__format__(__printf__, 3, 0))); |
__attribute__((__format__(__printf__, 3, 0))); |
|
|
/* tcpd_diag - centralize error reporter */ |
/* tcpd_diag - centralize error reporter */ |
|
|
static void tcpd_diag(severity, tag, format, ap) |
static void |
int severity; |
tcpd_diag(int severity, const char *tag, const char *format, va_list ap) |
char *tag; |
|
char *format; |
|
va_list ap; |
|
{ |
{ |
char fmt[BUFSIZ]; |
char fmt[BUFSIZ]; |
char buf[BUFSIZ]; |
char buf[BUFSIZ]; |
int i, o, oerrno; |
size_t i, o; |
|
int oerrno; |
|
|
/* save errno in case we need it */ |
/* save errno in case we need it */ |
oerrno = errno; |
oerrno = errno; |
|
|
|
|
/* tcpd_warn - report problem of some sort and proceed */ |
/* tcpd_warn - report problem of some sort and proceed */ |
|
|
void VARARGS(tcpd_warn, char *, format) |
void |
|
tcpd_warn(const char *format, ...) |
{ |
{ |
va_list ap; |
va_list ap; |
|
|
VASTART(ap, char *, format); |
va_start(ap, format); |
tcpd_diag(LOG_ERR, "warning", format, ap); |
tcpd_diag(LOG_ERR, "warning", format, ap); |
VAEND(ap); |
va_end(ap); |
} |
} |
|
|
/* tcpd_jump - report serious problem and jump */ |
/* tcpd_jump - report serious problem and jump */ |
|
|
void VARARGS(tcpd_jump, char *, format) |
void |
|
tcpd_jump(const char *format, ...) |
{ |
{ |
va_list ap; |
va_list ap; |
|
|
VASTART(ap, char *, format); |
va_start(ap, format); |
tcpd_diag(LOG_ERR, "error", format, ap); |
tcpd_diag(LOG_ERR, "error", format, ap); |
VAEND(ap); |
va_end(ap); |
longjmp(tcpd_buf, AC_ERROR); |
longjmp(tcpd_buf, AC_ERROR); |
} |
} |