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, ...) ...@@ -209,10 +209,12 @@ mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...)
209 va_list ap; 209 va_list ap;
210 210
211 va_start (ap, fmt); 211 va_start (ap, fmt);
212 mu_stream_printf (mach->errstream, "\033s<%d>\033O<%d>\033f<%u>%s\033l<%u>", 212 mu_stream_printf (mach->errstream, "\033s<%d>", MU_LOG_ERROR);
213 MU_LOG_ERROR, MU_LOGMODE_LOCUS, 213 if (mach->locus.mu_file)
214 strlen (mach->locus.mu_file), mach->locus.mu_file, 214 mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>",
215 mach->locus.mu_line); 215 MU_LOGMODE_LOCUS,
216 strlen (mach->locus.mu_file), mach->locus.mu_file,
217 mach->locus.mu_line);
216 if (mach->identifier) 218 if (mach->identifier)
217 mu_stream_printf (mach->errstream, "%s: ", mach->identifier); 219 mu_stream_printf (mach->errstream, "%s: ", mach->identifier);
218 mu_stream_vprintf (mach->errstream, fmt, ap); 220 mu_stream_vprintf (mach->errstream, fmt, ap);
...@@ -232,11 +234,12 @@ mu_sieve_debug (mu_sieve_machine_t mach, const char *fmt, ...) ...@@ -232,11 +234,12 @@ mu_sieve_debug (mu_sieve_machine_t mach, const char *fmt, ...)
232 va_list ap; 234 va_list ap;
233 235
234 va_start (ap, fmt); 236 va_start (ap, fmt);
235 mu_stream_printf (mach->errstream, 237 mu_stream_printf (mach->errstream, "\033s<%d>", MU_LOG_DEBUG);
236 "\033s<%d>\033O<%d>\033f<%u>%s\033l<%u>", 238 if (mach->locus.mu_file)
237 MU_LOG_DEBUG, MU_LOGMODE_LOCUS, 239 mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>",
238 strlen (mach->locus.mu_file), mach->locus.mu_file, 240 MU_LOGMODE_LOCUS,
239 mach->locus.mu_line); 241 strlen (mach->locus.mu_file), mach->locus.mu_file,
242 mach->locus.mu_line);
240 mu_stream_vprintf (mach->errstream, fmt, ap); 243 mu_stream_vprintf (mach->errstream, fmt, ap);
241 mu_stream_write (mach->errstream, "\n", 1, NULL); 244 mu_stream_write (mach->errstream, "\n", 1, NULL);
242 va_end (ap); 245 va_end (ap);
...@@ -251,11 +254,12 @@ mu_sieve_log_action (mu_sieve_machine_t mach, const char *action, ...@@ -251,11 +254,12 @@ mu_sieve_log_action (mu_sieve_machine_t mach, const char *action,
251 if (!mach->logger) 254 if (!mach->logger)
252 return; 255 return;
253 va_start (ap, fmt); 256 va_start (ap, fmt);
254 mu_stream_printf (mach->errstream, 257 mu_stream_printf (mach->errstream, "\033s<%d>", MU_LOG_INFO);
255 "\033s<%d>\033O<%d>\033f<%u>%s\033l<%u>", 258 if (mach->locus.mu_file)
256 MU_LOG_INFO, MU_LOGMODE_LOCUS, 259 mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>",
257 strlen (mach->locus.mu_file), mach->locus.mu_file, 260 MU_LOGMODE_LOCUS,
258 mach->locus.mu_line); 261 strlen (mach->locus.mu_file), mach->locus.mu_file,
262 mach->locus.mu_line);
259 mach->logger (mach->data, mach->errstream, mach->msgno, mach->msg, 263 mach->logger (mach->data, mach->errstream, mach->msgno, mach->msg,
260 action, fmt, ap); 264 action, fmt, ap);
261 va_end (ap); 265 va_end (ap);
......