dovecot-2.2: lib-settings: Improved error messages when config s...

dovecot at dovecot.org dovecot at dovecot.org
Wed Mar 20 21:45:49 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/09fcb43c47a4
changeset: 16076:09fcb43c47a4
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 04 15:18:08 2013 +0200
description:
lib-settings: Improved error messages when config server disconnects too early.

diffstat:

 src/lib-settings/settings-parser.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (36 lines):

diff -r 311371856dcf -r 09fcb43c47a4 src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c	Wed Feb 27 13:07:35 2013 +0200
+++ b/src/lib-settings/settings-parser.c	Mon Mar 04 15:18:08 2013 +0200
@@ -950,8 +950,15 @@
 		if (input->stream_errno != 0) {
 			ctx->error = p_strdup_printf(ctx->parser_pool,
 						     "read() failed: %m");
+		} else if (input->v_offset == 0) {
+			ctx->error = p_strdup_printf(ctx->parser_pool,
+				"read(%s) disconnected before receiving any data",
+				i_stream_get_name(input));
 		} else {
-			ctx->error = "input is missing end-of-settings line";
+			ctx->error = p_strdup_printf(ctx->parser_pool,
+				"read(%s) disconnected before receiving "
+				"end-of-settings line",
+				i_stream_get_name(input));
 		}
 		break;
 	case -2:
@@ -982,6 +989,7 @@
 	}
 
 	input = i_stream_create_fd(fd, max_line_length, TRUE);
+	i_stream_set_name(input, path);
 	ret = settings_parse_stream_read(ctx, input);
 	i_stream_unref(&input);
 
@@ -1071,6 +1079,7 @@
 	(void)close(fd[1]);
 
 	input = i_stream_create_fd(fd[0], (size_t)-1, TRUE);
+	i_stream_set_name(input, bin_path);
 	ret = settings_parse_stream_read(ctx, input);
 	i_stream_destroy(&input);
 


More information about the dovecot-cvs mailing list