dovecot-2.2: doveadm replicator replicate: -p parameter wasn't w...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 23 17:54:27 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/b4e2048e5312
changeset: 17253:b4e2048e5312
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 23 20:53:55 2014 +0300
description:
doveadm replicator replicate: -p parameter wasn't working correctly.
We were just replicating the "-p" as the username.

diffstat:

 src/doveadm/doveadm-replicator.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (66 lines):

diff -r e20a6192ddcf -r b4e2048e5312 src/doveadm/doveadm-replicator.c
--- a/src/doveadm/doveadm-replicator.c	Wed Apr 23 19:21:40 2014 +0300
+++ b/src/doveadm/doveadm-replicator.c	Wed Apr 23 20:53:55 2014 +0300
@@ -70,7 +70,7 @@
 }
 
 static struct replicator_context *
-cmd_replicator_init(int argc, char *argv[], const char *getopt_args,
+cmd_replicator_init(int *argc, char **argv[], const char *getopt_args,
 		    doveadm_command_t *cmd)
 {
 	struct replicator_context *ctx;
@@ -80,7 +80,7 @@
 	ctx->socket_path = t_strconcat(doveadm_settings->base_dir,
 				       "/replicator-doveadm", NULL);
 
-	while ((c = getopt(argc, argv, getopt_args)) > 0) {
+	while ((c = getopt(*argc, *argv, getopt_args)) > 0) {
 		switch (c) {
 		case 'a':
 			ctx->socket_path = optarg;
@@ -92,6 +92,8 @@
 			replicator_cmd_help(cmd);
 		}
 	}
+	*argc -= optind-1;
+	*argv += optind-1;
 	replicator_connect(ctx);
 	return ctx;
 }
@@ -137,7 +139,7 @@
 	const char *line, *const *args;
 	time_t last_fast, last_full;
 
-	ctx = cmd_replicator_init(argc, argv, "a:", cmd_replicator_status);
+	ctx = cmd_replicator_init(&argc, &argv, "a:", cmd_replicator_status);
 
 	if (argv[1] == NULL) {
 		cmd_replicator_status_overview(ctx);
@@ -183,7 +185,7 @@
 	const char *line;
 	unsigned int i;
 
-	ctx = cmd_replicator_init(argc, argv, "a:", cmd_replicator_dsync_status);
+	ctx = cmd_replicator_init(&argc, &argv, "a:", cmd_replicator_dsync_status);
 
 	doveadm_print_init(DOVEADM_PRINT_TYPE_TABLE);
 	doveadm_print_header("username", "username",
@@ -219,7 +221,7 @@
 	if (argv[1] == NULL)
 		replicator_cmd_help(cmd_replicator_replicate);
 
-	ctx = cmd_replicator_init(argc, argv, "a:p:", cmd_replicator_replicate);
+	ctx = cmd_replicator_init(&argc, &argv, "a:p:", cmd_replicator_replicate);
 
 	str = t_str_new(128);
 	str_append(str, "REPLICATE\t");
@@ -258,7 +260,7 @@
 	if (argv[1] == NULL)
 		replicator_cmd_help(cmd_replicator_remove);
 
-	ctx = cmd_replicator_init(argc, argv, "a:", cmd_replicator_remove);
+	ctx = cmd_replicator_init(&argc, &argv, "a:", cmd_replicator_remove);
 
 	str = t_str_new(128);
 	str_append(str, "REMOVE\t");


More information about the dovecot-cvs mailing list