Mercurial > dovecot > core-2.2
comparison src/doveadm/dsync/doveadm-dsync.c @ 15641:19403b3926f9
Several fixes to handling "istream input line too long" conditions.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 14 Jan 2013 08:01:47 +0200 |
parents | b468c30c4522 |
children | 4260de42d93c |
comparison
equal
deleted
inserted
replaced
15640:20a545f932e3 | 15641:19403b3926f9 |
---|---|
59 | 59 |
60 static bool legacy_dsync = FALSE; | 60 static bool legacy_dsync = FALSE; |
61 | 61 |
62 static void remote_error_input(struct dsync_cmd_context *ctx) | 62 static void remote_error_input(struct dsync_cmd_context *ctx) |
63 { | 63 { |
64 const unsigned char *data; | |
65 size_t size; | |
64 const char *line; | 66 const char *line; |
65 | 67 |
66 while ((line = i_stream_read_next_line(ctx->err_stream)) != NULL) | 68 switch (i_stream_read(ctx->err_stream)) { |
67 fprintf(stderr, "%s\n", line); | 69 case -2: |
68 | 70 data = i_stream_get_data(ctx->err_stream, &size); |
69 if (ctx->err_stream->eof && ctx->io_err != NULL) | 71 fprintf(stderr, "%.*s", (int)size, data); |
70 io_remove(&ctx->io_err); | 72 i_stream_skip(ctx->err_stream, size); |
73 break; | |
74 case -1: | |
75 if (ctx->io_err != NULL) | |
76 io_remove(&ctx->io_err); | |
77 break; | |
78 default: | |
79 while ((line = i_stream_next_line(ctx->err_stream)) != NULL) | |
80 fprintf(stderr, "%s\n", line); | |
81 break; | |
82 } | |
71 } | 83 } |
72 | 84 |
73 static void | 85 static void |
74 run_cmd(struct dsync_cmd_context *ctx, const char *const *args) | 86 run_cmd(struct dsync_cmd_context *ctx, const char *const *args) |
75 { | 87 { |