/* Copyright (c) 2001-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "dovecot-version.h"
#include "array.h"
#include "event-filter.h"
#include "env-util.h"
#include "hostpid.h"
#include "ipwd.h"
#include "process-title.h"
#include "var-expand-private.h"
#include "randgen.h"
#include <fcntl.h>
#include <unistd.h>
/* Mainly for including the full version information in core dumps.
NOTE: Don't set this const - otherwise it won't end up in core dumps. */
struct atexit_callback {
int priority;
};
unsigned int source_linenum)
{
i_error("unlink(%s) failed: %m (in %s:%u)",
return -1;
}
return 0;
}
unsigned int source_linenum)
{
return 1;
return 0;
else {
i_error("unlink(%s) failed: %m (in %s:%u)",
return -1;
}
}
void i_getopt_reset(void)
{
#ifdef __GLIBC__
/* a) for subcommands allow -options anywhere in command line
b) this is actually required for the reset to work (glibc bug?) */
optind = 0;
#else
optind = 1;
#endif
}
{
}
{
unsigned int i, count;
if (!array_is_created(&atexit_callbacks))
else {
/* skip if it's already added */
for (i = count; i > 0; i--) {
return;
}
}
}
}
const struct atexit_callback *cb2)
{
}
void lib_atexit_run(void)
{
if (array_is_created(&atexit_callbacks)) {
}
}
static void lib_open_non_stdio_dev_null(void)
{
if (dev_null_fd == -1)
/* Make sure stdin, stdout and stderr fds exist. We especially rely on
stderr being available and a lot of code doesn't like fd being 0.
reads are attempted from it we'll want them to fail. */
while (dev_null_fd < STDERR_FILENO) {
if (dev_null_fd == -1)
}
}
void lib_init(void)
{
random_init();
hostpid_init();
}
bool lib_is_initialized(void)
{
return lib_initialized;
}
void lib_deinit(void)
{
ipwd_deinit();
env_deinit();
}