dovecot: If rename() fails, log an error.

dovecot at dovecot.org dovecot at dovecot.org
Sat Sep 22 17:36:42 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/bca937328758
changeset: 6468:bca937328758
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Sep 22 17:36:38 2007 +0300
description:
If rename() fails, log an error.

diffstat:

1 file changed, 7 insertions(+), 2 deletions(-)
src/plugins/lazy-expunge/lazy-expunge-plugin.c |    9 +++++++--

diffs (26 lines):

diff -r 7499e36629c6 -r bca937328758 src/plugins/lazy-expunge/lazy-expunge-plugin.c
--- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Sat Sep 22 17:33:58 2007 +0300
+++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Sat Sep 22 17:36:38 2007 +0300
@@ -134,7 +134,7 @@ struct lazy_expunge_move_context {
 	unsigned int dir_len;
 };
 
-static int lazy_expunge_move(struct maildir_mailbox *mbox ATTR_UNUSED,
+static int lazy_expunge_move(struct maildir_mailbox *mbox,
 			     const char *path, void *context)
 {
 	struct lazy_expunge_move_context *ctx = context;
@@ -146,7 +146,12 @@ static int lazy_expunge_move(struct mail
 
 	if (rename(path, str_c(ctx->path)) == 0)
 		return 1;
-	return errno == ENOENT ? 0 : -1;
+	if (errno == ENOENT)
+		return 0;
+	mail_storage_set_critical(mbox->ibox.box.storage,
+				  "rename(%s, %s) failed: %m",
+				  path, str_c(ctx->path));
+	return -1;
 }
 
 static int lazy_expunge_move_expunges(struct mailbox *srcbox,


More information about the dovecot-cvs mailing list