dovecot-2.2: director: Small code cleanup - make it easier to ad...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 19 10:50:02 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/8e9cada0c8fc
changeset: 19309:8e9cada0c8fc
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 19 13:40:52 2015 +0300
description:
director: Small code cleanup - make it easier to add parameters to HOST

diffstat:

 src/director/director-connection.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (40 lines):

diff -r 66be949b9bcc -r 8e9cada0c8fc src/director/director-connection.c
--- a/src/director/director-connection.c	Mon Oct 19 13:37:25 2015 +0300
+++ b/src/director/director-connection.c	Mon Oct 19 13:40:52 2015 +0300
@@ -864,26 +864,26 @@
 	struct mail_host *host;
 	struct ip_addr ip;
 	const char *tag = "";
-	unsigned int vhost_count;
+	unsigned int arg_count, vhost_count;
 	bool update, down = FALSE;
 	time_t last_updown_change = 0;
 
-	if (str_array_length(args) < 2 ||
+	arg_count = str_array_length(args);
+	if (arg_count < 2 ||
 	    net_addr2ip(args[0], &ip) < 0 ||
 	    str_to_uint(args[1], &vhost_count) < 0) {
 		director_cmd_error(conn, "Invalid parameters");
 		return FALSE;
 	}
-	if (args[2] != NULL) {
+	if (arg_count >= 3)
 		tag = args[2];
-		if (args[3] != NULL) {
-			if ((args[3][0] != 'D' && args[3][0] != 'U') ||
-			    str_to_time(args[3]+1, &last_updown_change) < 0) {
-				director_cmd_error(conn, "Invalid updown parameters");
-				return FALSE;
-			}
-			down = args[3][0] == 'D';
+	if (arg_count >= 4) {
+		if ((args[3][0] != 'D' && args[3][0] != 'U') ||
+		    str_to_time(args[3]+1, &last_updown_change) < 0) {
+			director_cmd_error(conn, "Invalid updown parameters");
+			return FALSE;
 		}
+		down = args[3][0] == 'D';
 	}
 	if (conn->ignore_host_events) {
 		/* remote is sending hosts in a handshake, but it doesn't have


More information about the dovecot-cvs mailing list