]> git.tue.mpg.de Git - paraslash.git/commitdiff
para_client: Fix --user.
authorAndre Noll <maan@systemlinux.org>
Sun, 4 Apr 2010 22:57:47 +0000 (00:57 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 4 Apr 2010 22:57:47 +0000 (00:57 +0200)
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.

client_common.c

index 197f031c476a79ee00bc2143945356a20330595c..ccb17176c0b7c53351d2bbe98e767e8d4be39d45 100644 (file)
@@ -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);