diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-12-23 16:33:25 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-12-23 16:33:25 +0200 |
commit | b54dd7430263789adc872f7568cde84cf14f66d4 (patch) | |
tree | 7c1fb4e5318795442dae1ad4490f54a3e6fdf0e2 | |
parent | c1421c3a608c87f900733fe336f807546cac93b1 (diff) | |
download | mailutils-b54dd7430263789adc872f7568cde84cf14f66d4.tar.gz mailutils-b54dd7430263789adc872f7568cde84cf14f66d4.tar.bz2 |
Bugfix (complements 6bd92d3c07).
* libmu_sieve/util.c (mu_sieve_error, mu_sieve_debug)
(mu_sieve_log_action): Format location only if locus.mu_file
is not NULL.
-rw-r--r-- | libmu_sieve/util.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/libmu_sieve/util.c b/libmu_sieve/util.c index 629b75076..35685abda 100644 --- a/libmu_sieve/util.c +++ b/libmu_sieve/util.c @@ -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); |