From: Andre Noll <maan@systemlinux.org>
Date: Sun, 4 Apr 2010 22:57:47 +0000 (+0200)
Subject: para_client: Fix --user.
X-Git-Tag: v0.4.2~15^2
X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=2303f8c4c3eb7635db3598c531532ffcf88c31fc;p=paraslash.git

para_client: Fix --user.

In case the user was given in the config file but not at the
command line, the logname was used. --key_file had a similar
problem.

Fix this by moving the initialization of these two variables
down, after the config file has been read.
---

diff --git a/client_common.c b/client_common.c
index 197f031c..ccb17176 100644
--- a/client_common.c
+++ b/client_common.c
@@ -366,12 +366,6 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr,
 	ret = -E_CLIENT_SYNTAX;
 	if (!ct->conf.inputs_num)
 		goto out;
-	ct->user = ct->conf.user_given?
-		para_strdup(ct->conf.user_arg) : para_logname();
-
-	ct->key_file = ct->conf.key_file_given?
-		para_strdup(ct->conf.key_file_arg) :
-		make_message("%s/.paraslash/key.%s", home, ct->user);
 
 	ct->config_file = ct->conf.config_file_given?
 		para_strdup(ct->conf.config_file_arg) :
@@ -394,6 +388,13 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr,
 			&ct->conf, &params))
 			goto out;
 	}
+	ct->user = ct->conf.user_given?
+		para_strdup(ct->conf.user_arg) : para_logname();
+
+	ct->key_file = ct->conf.key_file_given?
+		para_strdup(ct->conf.key_file_arg) :
+		make_message("%s/.paraslash/key.%s", home, ct->user);
+
 	if (loglevel)
 		*loglevel = get_loglevel_by_name(ct->conf.loglevel_arg);
 	PARA_INFO_LOG("loglevel: %s\n", ct->conf.loglevel_arg);