failures.c revision b1ea8d3913eab1b7dd793f33b45ebb5389460f96
/* Copyright (c) 2002-2003 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "backtrace-string.h"
#include "write-full.h"
#include "fd-close-on-exec.h"
#include "printf-upper-bound.h"
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <time.h>
__attr_format__(1, 0);
__attr_format__(1, 0);
__attr_format__(1, 0);
/* 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 __attr_format__(3, 0)
{
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);
/* write may have failed, restore errno so %m works. although
it probably can't write the error then anyway. */
/* make sure there's no %n in there and fix %m */
}
fputc('\n', f);
t_pop();
recursed--;
return 0;
}
static void __attr_format__(1, 0)
{
const char *backtrace;
if (backtrace_get(&backtrace) == 0)
abort();
}
static void __attr_format__(2, 0)
{
status == FATAL_DEFAULT)
}
static void __attr_format__(1, 0)
{
}
static void __attr_format__(1, 0)
{
}
static void __attr_format__(1, 0)
{
if (fflush(log_info_fd) < 0)
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
static int __attr_format__(2, 0)
{
static int recursed = 0;
if (recursed != 0)
return -1;
recursed++;
/* make sure there's no %n in there */
recursed--;
return 0;
}
{
const char *backtrace;
if (backtrace_get(&backtrace) == 0)
abort();
}
{
}
{
}
{
}
{
}
{
}
{
else {
"Can't open log file %s: %m", path);
}
}
}
{
log_info_fd != stderr)
(void)fclose(log_info_fd);
}
static int __attr_format__(2, 0)
{
int ret;
t_push();
t_pop();
return ret;
}
{
const char *backtrace;
if (backtrace_get(&backtrace) == 0)
abort();
}
{
}
static void __attr_format__(1, 0)
{
}
static void __attr_format__(1, 0)
{
}
static void __attr_format__(1, 0)
{
}
void i_set_failure_internal(void)
{
}
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);
}
}