From 6f184ace4471995230ab680c376cdeb9978e0fa0 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Tue, 4 Dec 2007 02:31:57 +0100 Subject: [PATCH] Added a little more error logging to the lda-sieve plugin. --- src/plugins/lda-sieve/lda-sieve-plugin.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/plugins/lda-sieve/lda-sieve-plugin.c b/src/plugins/lda-sieve/lda-sieve-plugin.c index a621945ad..558246b82 100644 --- a/src/plugins/lda-sieve/lda-sieve-plugin.c +++ b/src/plugins/lda-sieve/lda-sieve-plugin.c @@ -83,14 +83,22 @@ static int lda_sieve_run struct sieve_mail_environment mailenv; struct sieve_error_handler *ehandler; struct sieve_binary *sbin; + const char *scriptlog; - ehandler = sieve_logfile_ehandler_create(t_strconcat(script_path, ".log", NULL)); + t_push(); + + scriptlog = t_strconcat(script_path, ".log", NULL); + ehandler = sieve_logfile_ehandler_create(scriptlog); if ( debug ) - i_info("lda-sieve: Compiling script %s", script_path); + i_info("sieve: Compiling script %s", script_path); if ( (sbin=sieve_compile(script_path, ehandler)) == NULL ) { + i_error("sieve: Failed to compile script. " + "Log should be available as %s.", scriptlog); + sieve_error_handler_free(&ehandler); + t_pop(); return -1; } @@ -116,11 +124,15 @@ static int lda_sieve_run mailenv.duplicate_check = duplicate_check; if ( debug ) - i_info("lda-sieve: Executing (in-memory) script %s", script_path); + i_info("sieve: Executing (in-memory) script %s", script_path); - if ( sieve_execute(sbin, &msgdata, &mailenv) ) + if ( sieve_execute(sbin, &msgdata, &mailenv) ) { + i_error("sieve: Failed to execute script"); + t_pop(); return 1; + } + t_pop(); return -1; } -- GitLab