changeset 20827:7691ad109879

log: Minor error logging and comment improvement.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 06 Oct 2016 13:39:21 +0300
parents dd023ac91c67
children d7bed2a85e99
files src/log/log-connection.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/log/log-connection.c	Thu Oct 06 13:09:46 2016 +0300
+++ b/src/log/log-connection.c	Thu Oct 06 13:39:21 2016 +0300
@@ -283,9 +283,13 @@
 	size_t size;
 	ssize_t ret;
 
+	/* we're reading from a FIFO, so we're assuming that we're getting a
+	   full handshake packet immediately. if not, treat it as an error
+	   message that we want to log. */
 	ret = i_stream_read(log->input);
 	if (ret < 0) {
-		i_error("read(log %s) failed: %m", log->default_prefix);
+		i_error("read(log %s) failed: %s", log->default_prefix,
+			i_stream_get_error(log->input));
 		return -1;
 	}
 	if ((size_t)ret < sizeof(handshake)) {
@@ -336,6 +340,9 @@
 			log_connection_destroy(log);
 			return;
 		}
+		/* come back here even if we read something else besides a
+		   handshake. the first few lines could be coming from e.g.
+		   libc before the proper handshake line is sent. */
 	}
 
 	io_loop_time_refresh();