From c09999a00aa049418b7ea41428ee5aedfcd1e889 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 20 Feb 2009 22:47:06 +0100 Subject: [PATCH] Simplify client_open(). Use the file_exists() helper and add missing documenation for the loglevel arg. --- client_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client_common.c b/client_common.c index d5807e75..c1e23f7a 100644 --- a/client_common.c +++ b/client_common.c @@ -312,6 +312,7 @@ err_out: * \param argv Usual argument vector. * \param ct_ptr Points to dynamically allocated and initialized client task * struct upon successful return. + * \param loglevel If not \p NULL, the number of the loglevel is stored here. * * Check the command line options given by \a argc and argv, set default values * for user name and rsa key file, read further option from the config file. @@ -323,7 +324,6 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr, int *loglevel) { char *home = para_homedir(); - struct stat statbuf; int ret; struct client_task *ct = para_calloc(sizeof(struct client_task)); @@ -346,12 +346,12 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr, ct->config_file = ct->conf.config_file_given? para_strdup(ct->conf.config_file_arg) : make_message("%s/.paraslash/client.conf", home); - ret = stat(ct->config_file, &statbuf); - if (ret && ct->conf.config_file_given) { + ret = file_exists(ct->config_file); + if (!ret && ct->conf.config_file_given) { ret = -E_NO_CONFIG; goto out; } - if (!ret) { + if (ret) { struct client_cmdline_parser_params params = { .override = 0, .initialize = 0, -- 2.39.5