dovecot-2.2: log: Small cleanup: Include log connection prefix w...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 7 16:18:11 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/46e28c6ef002
changeset: 18229:46e28c6ef002
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Feb 07 18:17:59 2015 +0200
description:
log: Small cleanup: Include log connection prefix when logging read() errors.

diffstat:

 src/log/log-connection.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 2f15ae9bc1b3 -r 46e28c6ef002 src/log/log-connection.c
--- a/src/log/log-connection.c	Sat Feb 07 18:14:53 2015 +0200
+++ b/src/log/log-connection.c	Sat Feb 07 18:17:59 2015 +0200
@@ -243,7 +243,7 @@
 
 	ret = i_stream_read(log->input);
 	if (ret < 0) {
-		i_error("read(log pipe) failed: %m");
+		i_error("read(log %s) failed: %m", log->default_prefix);
 		return -1;
 	}
 	if ((size_t)ret < sizeof(handshake)) {
@@ -264,6 +264,7 @@
 		i_error("Missing prefix data in handshake");
 		return -1;
 	}
+	i_free(log->default_prefix);
 	log->default_prefix = i_strndup(data + sizeof(handshake),
 					handshake.prefix_len);
 	i_stream_skip(log->input, sizeof(handshake) + handshake.prefix_len);
@@ -307,7 +308,7 @@
 	if (log->input->eof)
 		log_connection_destroy(log);
 	else if (log->input->stream_errno != 0) {
-		i_error("read(log pipe) failed: %m");
+		i_error("read(log %s) failed: %m", log->default_prefix);
 		log_connection_destroy(log);
 	} else {
 		i_assert(!log->input->closed);
@@ -325,6 +326,7 @@
 	log->listen_fd = listen_fd;
 	log->io = io_add(fd, IO_READ, log_connection_input, log);
 	log->input = i_stream_create_fd(fd, PIPE_BUF, FALSE);
+	log->default_prefix = i_strdup_printf("listen_fd %d", listen_fd);
 	hash_table_create_direct(&log->clients, default_pool, 0);
 	array_idx_set(&logs_by_fd, listen_fd, &log);
 


More information about the dovecot-cvs mailing list