changeset 19872:b484b95d3dcb

doveadm: Fixed command parameter handling for doveadm-server.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Fri, 26 Feb 2016 16:21:38 +0200
parents 8e662e9d6c06
children 470497fb205c
files src/doveadm/client-connection.c
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/client-connection.c	Fri Feb 26 16:05:01 2016 +0200
+++ b/src/doveadm/client-connection.c	Fri Feb 26 16:21:38 2016 +0200
@@ -282,8 +282,9 @@
 		return FALSE;
 	}
 	memset(&attrs, 0, sizeof(attrs));
-	attrs.argv = (const char **)args;
-	attrs.argc = argc;
+	/* leave the command name as args[0] so getopt() works */
+	attrs.argv = (const char **)args + 2;
+	attrs.argc = argc - 2;
 
 	attrs.local_ip = conn->local_ip;
 	attrs.remote_ip = conn->remote_ip;
@@ -292,11 +293,7 @@
 
 	flags = args[0];
 	attrs.username = args[1];
-
 	cmd_name = args[2];
-	/* leave the command name as args[0] so getopt() works */
-	args += 2;
-	argc -= 2;
 
 	doveadm_debug = FALSE;
 	doveadm_verbose = FALSE;