]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Improved error messages when config server disconnects too early.
authorTimo Sirainen <tss@iki.fi>
Mon, 4 Mar 2013 13:18:08 +0000 (15:18 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 4 Mar 2013 13:18:08 +0000 (15:18 +0200)
src/lib-settings/settings-parser.c

index cfa3a38b22cb21764ddefb6ee7e4340557cc1145..b5eee2ca44e9cbcbc8edcc7bc4050340860332d6 100644 (file)
@@ -950,8 +950,15 @@ int settings_parse_stream_read(struct setting_parser_context *ctx,
                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 @@ int settings_parse_file(struct setting_parser_context *ctx,
        }
 
        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 @@ int settings_parse_exec(struct setting_parser_context *ctx,
        (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);