Commit b54dd743 b54dd7430263789adc872f7568cde84cf14f66d4 by Sergey Poznyakoff

Bugfix (complements 6bd92d3c).

* libmu_sieve/util.c (mu_sieve_error, mu_sieve_debug)
(mu_sieve_log_action): Format location only if locus.mu_file
is not NULL.
1 parent c1421c3a
......@@ -209,10 +209,12 @@ mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...)
va_list ap;
va_start (ap, fmt);
mu_stream_printf (mach->errstream, "\033s<%d>\033O<%d>\033f<%u>%s\033l<%u>",
MU_LOG_ERROR, MU_LOGMODE_LOCUS,
strlen (mach->locus.mu_file), mach->locus.mu_file,
mach->locus.mu_line);
mu_stream_printf (mach->errstream, "\033s<%d>", MU_LOG_ERROR);
if (mach->locus.mu_file)
mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>",
MU_LOGMODE_LOCUS,
strlen (mach->locus.mu_file), mach->locus.mu_file,
mach->locus.mu_line);
if (mach->identifier)
mu_stream_printf (mach->errstream, "%s: ", mach->identifier);
mu_stream_vprintf (mach->errstream, fmt, ap);
......@@ -232,11 +234,12 @@ mu_sieve_debug (mu_sieve_machine_t mach, const char *fmt, ...)
va_list ap;
va_start (ap, fmt);
mu_stream_printf (mach->errstream,
"\033s<%d>\033O<%d>\033f<%u>%s\033l<%u>",
MU_LOG_DEBUG, MU_LOGMODE_LOCUS,
strlen (mach->locus.mu_file), mach->locus.mu_file,
mach->locus.mu_line);
mu_stream_printf (mach->errstream, "\033s<%d>", MU_LOG_DEBUG);
if (mach->locus.mu_file)
mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>",
MU_LOGMODE_LOCUS,
strlen (mach->locus.mu_file), mach->locus.mu_file,
mach->locus.mu_line);
mu_stream_vprintf (mach->errstream, fmt, ap);
mu_stream_write (mach->errstream, "\n", 1, NULL);
va_end (ap);
......@@ -251,11 +254,12 @@ mu_sieve_log_action (mu_sieve_machine_t mach, const char *action,
if (!mach->logger)
return;
va_start (ap, fmt);
mu_stream_printf (mach->errstream,
"\033s<%d>\033O<%d>\033f<%u>%s\033l<%u>",
MU_LOG_INFO, MU_LOGMODE_LOCUS,
strlen (mach->locus.mu_file), mach->locus.mu_file,
mach->locus.mu_line);
mu_stream_printf (mach->errstream, "\033s<%d>", MU_LOG_INFO);
if (mach->locus.mu_file)
mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>",
MU_LOGMODE_LOCUS,
strlen (mach->locus.mu_file), mach->locus.mu_file,
mach->locus.mu_line);
mach->logger (mach->data, mach->errstream, mach->msgno, mach->msg,
action, fmt, ap);
va_end (ap);
......