dovecot-2.2: doveadm fs: Log also the exact reason for "file doe...

dovecot at dovecot.org dovecot at dovecot.org
Tue Oct 20 18:23:23 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/0c2f8cb41fea
changeset: 19325:0c2f8cb41fea
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Oct 20 21:23:03 2015 +0300
description:
doveadm fs: Log also the exact reason for "file doesn't exist"

diffstat:

 src/doveadm/doveadm-fs.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r 051505f9a5ae -r 0c2f8cb41fea src/doveadm/doveadm-fs.c
--- a/src/doveadm/doveadm-fs.c	Tue Oct 20 20:15:20 2015 +0300
+++ b/src/doveadm/doveadm-fs.c	Tue Oct 20 21:23:03 2015 +0300
@@ -72,7 +72,8 @@
 	}
 	i_assert(ret == -1);
 	if (input->stream_errno == ENOENT) {
-		i_error("%s doesn't exist", fs_file_path(file));
+		i_error("%s doesn't exist: %s", fs_file_path(file),
+			fs_file_last_error(file));
 		doveadm_exit_code = DOVEADM_EX_NOTFOUND;
 	} else if (input->stream_errno != 0) {
 		i_error("read(%s) failed: %s", fs_file_path(file),
@@ -165,7 +166,8 @@
 	dest_file = fs_file_init(fs, dest_path, FS_OPEN_MODE_REPLACE);
 	if (fs_copy(src_file, dest_file) == 0) ;
 	else if (errno == ENOENT) {
-		i_error("%s doesn't exist", src_path);
+		i_error("%s doesn't exist: %s", src_path,
+			fs_last_error(fs));
 		doveadm_exit_code = DOVEADM_EX_NOTFOUND;
 	} else {
 		i_error("fs_copy(%s, %s) failed: %s",
@@ -190,7 +192,8 @@
 		printf("%s size=%lld\n", fs_file_path(file),
 		       (long long)st.st_size);
 	} else if (errno == ENOENT) {
-		i_error("%s doesn't exist", fs_file_path(file));
+		i_error("%s doesn't exist: %s", fs_file_path(file),
+			fs_file_last_error(file));
 		doveadm_exit_code = DOVEADM_EX_NOTFOUND;
 	} else {
 		i_error("fs_stat(%s) failed: %s",
@@ -215,7 +218,8 @@
 		array_foreach(metadata, m)
 			printf("%s=%s\n", m->key, m->value);
 	} else if (errno == ENOENT) {
-		i_error("%s doesn't exist", fs_file_path(file));
+		i_error("%s doesn't exist: %s", fs_file_path(file),
+			fs_file_last_error(file));
 		doveadm_exit_code = DOVEADM_EX_NOTFOUND;
 	} else {
 		i_error("fs_stat(%s) failed: %s",
@@ -248,7 +252,8 @@
 			if (ret == 0)
 				ret = 1;
 		} else if (errno == ENOENT) {
-			i_error("%s doesn't exist", fs_file_path(ctx->files[i]));
+			i_error("%s doesn't exist: %s", fs_file_path(ctx->files[i]),
+				fs_file_last_error(ctx->files[i]));
 			doveadm_exit_code = DOVEADM_EX_NOTFOUND;
 			ret = -1;
 		} else {


More information about the dovecot-cvs mailing list