dovecot-2.2: imap, pop3, lmtp: If client gets disconnected due t...

dovecot at dovecot.org dovecot at dovecot.org
Sun Oct 19 18:25:05 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/086c70441f26
changeset: 17966:086c70441f26
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Oct 19 11:24:12 2014 -0700
description:
imap, pop3, lmtp: If client gets disconnected due to iostream error, log the full error.

diffstat:

 src/imap/imap-client.c |  8 ++++++--
 src/lmtp/client.c      |  9 ++++++---
 src/pop3/pop3-client.c |  9 ++++++---
 3 files changed, 18 insertions(+), 8 deletions(-)

diffs (58 lines):

diff -r cd5dba84d8de -r 086c70441f26 src/imap/imap-client.c
--- a/src/imap/imap-client.c	Sat Oct 18 02:13:30 2014 +0300
+++ b/src/imap/imap-client.c	Sun Oct 19 11:24:12 2014 -0700
@@ -223,8 +223,12 @@
 	errno = client->input->stream_errno != 0 ?
 		client->input->stream_errno :
 		client->output->stream_errno;
-	return errno == 0 || errno == EPIPE ? "Connection closed" :
-		t_strdup_printf("Connection closed: %m");
+	if (errno == 0 || errno == EPIPE)
+		return "Connection closed";
+	return t_strdup_printf("Connection closed: %s",
+			       client->input->stream_errno != 0 ?
+			       i_stream_get_error(client->input) :
+			       o_stream_get_error(client->output));
 }
 
 void client_destroy(struct client *client, const char *reason)
diff -r cd5dba84d8de -r 086c70441f26 src/lmtp/client.c
--- a/src/lmtp/client.c	Sat Oct 18 02:13:30 2014 +0300
+++ b/src/lmtp/client.c	Sun Oct 19 11:24:12 2014 -0700
@@ -293,10 +293,13 @@
 	errno = client->input->stream_errno != 0 ?
 		client->input->stream_errno :
 		client->output->stream_errno;
-	return errno == 0 || errno == EPIPE ? "Connection closed" :
-		t_strdup_printf("Connection closed: %m");
+	if (errno == 0 || errno == EPIPE)
+		return "Connection closed";
+	return t_strdup_printf("Connection closed: %s",
+			       client->input->stream_errno != 0 ?
+			       i_stream_get_error(client->input) :
+			       o_stream_get_error(client->output));
 }
-
 void client_disconnect(struct client *client, const char *prefix,
 		       const char *reason)
 {
diff -r cd5dba84d8de -r 086c70441f26 src/pop3/pop3-client.c
--- a/src/pop3/pop3-client.c	Sat Oct 18 02:13:30 2014 +0300
+++ b/src/pop3/pop3-client.c	Sun Oct 19 11:24:12 2014 -0700
@@ -557,10 +557,13 @@
 	errno = client->input->stream_errno != 0 ?
 		client->input->stream_errno :
 		client->output->stream_errno;
-	return errno == 0 || errno == EPIPE ? "Connection closed" :
-		t_strdup_printf("Connection closed: %m");
+	if (errno == 0 || errno == EPIPE)
+		return "Connection closed";
+	return t_strdup_printf("Connection closed: %s",
+			       client->input->stream_errno != 0 ?
+			       i_stream_get_error(client->input) :
+			       o_stream_get_error(client->output));
 }
-
 void client_destroy(struct client *client, const char *reason)
 {
 	client->v.destroy(client, reason);


More information about the dovecot-cvs mailing list