dovecot: Added missing error logging for file_dotlock_create/ope...

dovecot at dovecot.org dovecot at dovecot.org
Sun Nov 11 17:46:51 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/b78cfc60f6a1
changeset: 6772:b78cfc60f6a1
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Nov 11 16:49:37 2007 +0200
description:
Added missing error logging for file_dotlock_create/open calls.

diffstat:

4 files changed, 15 insertions(+), 2 deletions(-)
src/deliver/duplicate.c               |    2 ++
src/lib-index/mail-cache.c            |    4 ++++
src/lib-index/mail-hash.c             |    9 +++++++--
src/plugins/convert/convert-storage.c |    2 ++

diffs (57 lines):

diff -r fd9effba151d -r b78cfc60f6a1 src/deliver/duplicate.c
--- a/src/deliver/duplicate.c	Sun Nov 11 16:02:25 2007 +0200
+++ b/src/deliver/duplicate.c	Sun Nov 11 16:49:37 2007 +0200
@@ -210,6 +210,8 @@ static struct duplicate_file *duplicate_
 	file->path = p_strdup(pool, path);
 	file->new_fd = file_dotlock_open(&duplicate_dotlock_set, path, 0,
 					 &file->dotlock);
+	if (file->new_fd == -1)
+		i_error("file_dotlock_create(%s) failed: %m", path);
 	file->hash = hash_create(default_pool, pool, 0,
 				 duplicate_hash, duplicate_cmp);
 	(void)duplicate_read(file);
diff -r fd9effba151d -r b78cfc60f6a1 src/lib-index/mail-cache.c
--- a/src/lib-index/mail-cache.c	Sun Nov 11 16:02:25 2007 +0200
+++ b/src/lib-index/mail-cache.c	Sun Nov 11 16:49:37 2007 +0200
@@ -472,6 +472,10 @@ static int mail_cache_lock_file(struct m
 		i_assert(cache->dotlock == NULL);
 		ret = file_dotlock_create(&cache->dotlock_settings,
 					  cache->filepath, 0, &cache->dotlock);
+		if (ret < 0) {
+			mail_cache_set_syscall_error(cache,
+						     "file_dotlock_create()");
+		}
 	}
 
 	if (ret <= 0)
diff -r fd9effba151d -r b78cfc60f6a1 src/lib-index/mail-hash.c
--- a/src/lib-index/mail-hash.c	Sun Nov 11 16:02:25 2007 +0200
+++ b/src/lib-index/mail-hash.c	Sun Nov 11 16:49:37 2007 +0200
@@ -417,8 +417,13 @@ static int mail_hash_file_lock(struct ma
 					  &hash->file_lock);
 	} else {
 		i_assert(hash->dotlock == NULL);
-		return file_dotlock_create(&hash->dotlock_settings,
-					   hash->filepath, 0, &hash->dotlock);
+		if (file_dotlock_create(&hash->dotlock_settings,
+					hash->filepath, 0,
+					&hash->dotlock) < 0) {
+			mail_hash_set_syscall_error(hash, "open()");
+			return -1;
+		}
+		return 0;
 	}
 }
 
diff -r fd9effba151d -r b78cfc60f6a1 src/plugins/convert/convert-storage.c
--- a/src/plugins/convert/convert-storage.c	Sun Nov 11 16:02:25 2007 +0200
+++ b/src/plugins/convert/convert-storage.c	Sun Nov 11 16:49:37 2007 +0200
@@ -403,6 +403,8 @@ int convert_storage(const char *source_d
 	if (ret <= 0) {
 		if (ret == 0)
 			i_error("Mailbox conversion: Lock creation timeouted");
+		else
+			i_error("file_dotlock_create(%s) failed: %m", path);
 		return -1;
 	}
 


More information about the dovecot-cvs mailing list