dovecot-sieve-1.0: Log a bit more if debug is enabled.

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 19 18:23:20 EEST 2007


details:   http://hg.dovecot.org/dovecot-sieve-1.0/rev/64a7986b5e55
changeset: 21:64a7986b5e55
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 19 18:23:17 2007 +0300
description:
Log a bit more if debug is enabled.

diffstat:

1 file changed, 15 insertions(+), 1 deletion(-)
src/sieve-cmu.c |   16 +++++++++++++++-

diffs (48 lines):

diff -r c41e5970e2dc -r 64a7986b5e55 src/sieve-cmu.c
--- a/src/sieve-cmu.c	Sat Jun 16 03:35:45 2007 +0300
+++ b/src/sieve-cmu.c	Tue Jun 19 18:23:17 2007 +0300
@@ -17,6 +17,7 @@
 #include "cmusieve-plugin.h"
 
 #include <fcntl.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -457,8 +458,13 @@ dovecot_sieve_compile(sieve_interp_t *in
 	int fd, ret;
 
 	if (stat(script_path, &st) < 0) {
-		if (errno == ENOENT)
+		if (errno == ENOENT) {
+			if (getenv("DEBUG") != NULL) {
+				i_info("cmusieve: Script not found: %s",
+				       script_path);
+			}
 			return 0;
+		}
 		i_error("stat(%s) failed: %m", script_path);
 		return -1;
 	}
@@ -556,6 +562,11 @@ int cmu_sieve_run(struct mail_storage *s
 	ret = dovecot_sieve_compile(interp, &sdata, script_path, compiled_path);
 
 	if (sdata.errors != NULL) {
+		if (getenv("DEBUG") != NULL) {
+			i_info("cmusieve: Compilation failed for %s: %s",
+			       script_path,
+			       str_sanitize(str_c(sdata.errors), 80));
+		}
 		path = t_strconcat(script_path, ".err", NULL);
 		dovecot_sieve_write_error_file(&sdata, path);
 		str_free(&sdata.errors);
@@ -575,6 +586,9 @@ int cmu_sieve_run(struct mail_storage *s
 		return -1;
 	}
 
+	if (getenv("DEBUG") != NULL)
+		i_info("cmusieve: Executing script %s", compiled_path);
+
 	if (sieve_execute_bytecode(bytecode, interp,
 				   &sdata, &mdata) != SIEVE_OK)
 		return -1;


More information about the dovecot-cvs mailing list