]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap, pop3, lmtp: If client gets disconnected due to iostream error, log the full...
authorTimo Sirainen <tss@iki.fi>
Sun, 19 Oct 2014 18:24:12 +0000 (11:24 -0700)
committerTimo Sirainen <tss@iki.fi>
Sun, 19 Oct 2014 18:24:12 +0000 (11:24 -0700)
src/imap/imap-client.c
src/lmtp/client.c
src/pop3/pop3-client.c

index 613c11783a4c8e37c4ca4743681f97f3eba4f88b..f35a02ed3a21efc212e6a2960e6ea503f5d3ab5f 100644 (file)
@@ -223,8 +223,12 @@ static const char *client_get_disconnect_reason(struct client *client)
        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)
index 7b336641de1b8229e84bb8845d350b142dce04d0..8adae4b3514093e401e53e4e263acf4898e1c0c1 100644 (file)
@@ -293,10 +293,13 @@ static const char *client_get_disconnect_reason(struct client *client)
        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)
 {
index 096bf1f1a151acaa3128db6e7cbf695ba7f72f9f..2696ac90ae8c92be04bdda001ad2a8ecad433e49 100644 (file)
@@ -557,10 +557,13 @@ static const char *client_get_disconnect_reason(struct client *client)
        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);