failures.c revision fc34e919907845ce01ad04aa8213033596a1ae70
/* Copyright (c) 2002-2003 Timo Sirainen */
#include "lib.h"
#include "fd-close-on-exec.h"
#include "printf-upper-bound.h"
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <time.h>
/* Initialize working defaults */
/* kludgy .. we want to trust log_stamp_format with -Wformat-nonliteral */
static const char *get_log_stamp_format(const char *unused)
{
return log_stamp_format;
}
static void write_prefix(FILE *f)
{
char str[256];
if (log_prefix != NULL)
fputs(log_prefix, f);
if (log_stamp_format != NULL) {
}
}
{
static int recursed = 0;
if (recursed == 2) {
/* we're being called from some signal handler, or
printf_string_upper_bound() killed us again */
return -1;
}
recursed++;
if (f == NULL) {
f = stderr;
}
t_push();
if (recursed == 2) {
/* printf_string_upper_bound() probably killed us last time,
just write the format now. */
fputs("recursed: ", f);
} else {
write_prefix(f);
/* make sure there's no %n in there and fix %m */
}
fputc('\n', f);
t_pop();
recursed--;
return 0;
}
{
abort();
}
{
status == FATAL_DEFAULT)
}
{
}
{
}
{
if (fflush(log_info_fd) < 0)
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
static int recursed = 0;
if (recursed != 0)
return -1;
recursed++;
/* make sure there's no %n in there */
recursed--;
return 0;
}
{
abort();
}
{
}
{
}
{
}
{
}
{
}
{
else {
"Can't open log file %s: %m", path);
}
}
}
{
(void)fclose(log_info_fd);
}
void i_set_info_file(const char *path)
{
if (log_info_fd == log_fd)
log_info_fd = NULL;
}
void i_set_failure_timestamp_format(const char *fmt)
{
}
void failures_deinit(void)
{
if (log_info_fd == log_fd)
log_info_fd = NULL;
}
(void)fclose(log_info_fd);
}
log_prefix = NULL;
}