aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 938a82b6..cec23145 100644
--- a/src/main.c
+++ b/src/main.c
@@ -39,8 +39,6 @@
#include "mailfromd.h"
-#include "syslog_async.h"
-
/* Configurable options */
@@ -78,8 +76,11 @@ int foreground; /* Stay in foreground */
int single_process_option; /* Run in single process mode. */
unsigned long source_address = INADDR_ANY; /* Source address for TCP
connections */
+#ifdef USE_SYSLOG_ASYNC
int use_syslog_async = DEFAULT_SYSLOG_ASYNC;
- /* Use asynchronous syslog implementation */
+ /* Use asynchronous syslog implementation */
+#endif
+
char *syslog_tag; /* Tag to mark syslog entries with. */
char *mailfromd_state_dir; /* see init_names() */
char *pidfile; /* see init_names() */
@@ -125,9 +126,12 @@ time_t response_timeout = 30;
int
syslog_printer (int prio, const char *fmt, va_list ap)
{
+#ifdef USE_SYSLOG_ASYNC
if (use_syslog_async) {
vsyslog_async (prio, fmt, ap);
- } else {
+ } else
+#endif
+ {
#if HAVE_VSYSLOG
vsyslog (prio, fmt, ap);
#else
@@ -139,6 +143,7 @@ syslog_printer (int prio, const char *fmt, va_list ap)
return 0;
}
+#ifdef USE_SYSLOG_ASYNC
void
mf_gacopyz_syslog_async_log_printer(int level, char *fmt, va_list ap)
{
@@ -162,6 +167,7 @@ mf_gacopyz_syslog_async_log_printer(int level, char *fmt, va_list ap)
}
vsyslog_async(level, fmt, ap);
}
+#endif
int
syslog_error_printer (const char *fmt, va_list ap)
@@ -978,10 +984,12 @@ static struct argp_option options[] = {
N_("Log to stderr"), GRP+1 },
{ "syslog", OPTION_SYSLOG, NULL, 0,
N_("Log to syslog (default)"), GRP+1 },
+#ifdef USE_SYSLOG_ASYNC
{ "syslog-async", OPTION_SYSLOG_ASYNC, NULL, 0,
N_("Use asynchronous syslog"), GRP+1 },
{ "no-syslog-async", OPTION_NO_SYSLOG_ASYNC, NULL, 0,
N_("Use system syslog"), GRP+1 },
+#endif
{ "log-tag", OPTION_LOG_TAG, N_("STRING"), 0,
N_("Set the identifier used in syslog messages to STRING"), GRP+1 },
{ "source-info", OPTION_SOURCE_INFO, NULL, 0,
@@ -1301,6 +1309,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
log_to_stderr = 0;
break;
+#ifdef USE_SYSLOG_ASYNC
case OPTION_SYSLOG_ASYNC:
use_syslog_async = 1;
break;
@@ -1308,7 +1317,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
case OPTION_NO_SYSLOG_ASYNC:
use_syslog_async = 0;
break;
-
+#endif
case OPTION_TIMEOUT:
set_option("timeout", arg, 1);
break;
@@ -1702,11 +1711,13 @@ mailfromd_show_defaults()
printf("statedir: %s\n", mailfromd_state_dir);
printf("socket: %s\n", portspec);
printf("pidfile: %s\n", pidfile);
+#ifdef USE_SYSLOG_ASYNC
#if DEFAULT_SYSLOG_ASYNC == 1
printf("default syslog: non-blocking\n");
#else
printf("default syslog: blocking\n");
#endif
+#endif
printf("database format: ");
#if defined WITH_GDBM
printf("GDBM");
@@ -1723,10 +1734,13 @@ log_setup(int want_stderr)
{
/* Set up logging */
if (!want_stderr) {
+#ifdef USE_SYSLOG_ASYNC
if (use_syslog_async) {
openlog_async(syslog_tag, LOG_PID, log_facility);
gacopyz_set_logger(mf_gacopyz_syslog_async_log_printer);
- } else {
+ } else
+#endif
+ {
openlog(syslog_tag, LOG_PID, log_facility);
gacopyz_set_logger(gacopyz_syslog_log_printer);
}

Return to:

Send suggestions and report system problems to the System administrator.