dovecot-2.1: imapc: If rawlog directory doesn't exist, silently ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Nov 4 21:10:58 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/ebdb1d51ea14
changeset: 13651:ebdb1d51ea14
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Nov 04 21:17:09 2011 +0200
description:
imapc: If rawlog directory doesn't exist, silently ignore it.

diffstat:

 src/lib-imap-client/imapc-connection.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r a79c256b361e -r ebdb1d51ea14 src/lib-imap-client/imapc-connection.c
--- a/src/lib-imap-client/imapc-connection.c	Fri Nov 04 20:36:28 2011 +0200
+++ b/src/lib-imap-client/imapc-connection.c	Fri Nov 04 21:17:09 2011 +0200
@@ -1150,6 +1150,7 @@
 static int imapc_connection_ssl_init(struct imapc_connection *conn)
 {
 	struct ssl_iostream_settings ssl_set;
+	struct stat st;
 	const char *source;
 
 	if (conn->client->ssl_ctx == NULL) {
@@ -1194,7 +1195,8 @@
 		return -1;
 	}
 
-	if (*conn->client->set.rawlog_dir != '\0') {
+	if (*conn->client->set.rawlog_dir != '\0' &&
+	    stat(conn->client->set.rawlog_dir, &st) == 0) {
 		(void)iostream_rawlog_create(conn->client->set.rawlog_dir,
 					     &conn->input, &conn->output);
 	}
@@ -1268,6 +1270,7 @@
 static void imapc_connection_connect_next_ip(struct imapc_connection *conn)
 {
 	const struct ip_addr *ip;
+	struct stat st;
 	int fd;
 
 	conn->prev_connect_idx = (conn->prev_connect_idx+1) % conn->ips_count;
@@ -1282,7 +1285,8 @@
 	conn->output = conn->raw_output = o_stream_create_fd(fd, (size_t)-1, FALSE);
 
 	if (*conn->client->set.rawlog_dir != '\0' &&
-	    conn->client->set.ssl_mode != IMAPC_CLIENT_SSL_MODE_IMMEDIATE) {
+	    conn->client->set.ssl_mode != IMAPC_CLIENT_SSL_MODE_IMMEDIATE &&
+	    stat(conn->client->set.rawlog_dir, &st) == 0) {
 		(void)iostream_rawlog_create(conn->client->set.rawlog_dir,
 					     &conn->input, &conn->output);
 	}


More information about the dovecot-cvs mailing list