diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-12-11 17:47:58 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-12-11 17:47:58 +0100 |
commit | cefc7647dc8db23452da80cfb4384cca641bb99d (patch) | |
tree | 80a7cecd85bacc33eb2baeb7da2c0a88e6b8d105 /src/util/gnunet-config.c | |
parent | e68c4624f12fe7172ea6de5b4a5d89d9e49eae91 (diff) | |
download | gnunet-cefc7647dc8db23452da80cfb4384cca641bb99d.tar.gz gnunet-cefc7647dc8db23452da80cfb4384cca641bb99d.zip |
make sure peer launches if default config not found and -c not given
Diffstat (limited to 'src/util/gnunet-config.c')
-rw-r--r-- | src/util/gnunet-config.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 46c523da4..3c7eaa6dc 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -142,6 +142,7 @@ run (void *cls, | |||
142 | { | 142 | { |
143 | struct GNUNET_CONFIGURATION_Handle *out = NULL; | 143 | struct GNUNET_CONFIGURATION_Handle *out = NULL; |
144 | struct GNUNET_CONFIGURATION_Handle *diff = NULL; | 144 | struct GNUNET_CONFIGURATION_Handle *diff = NULL; |
145 | char *cfg_fn; | ||
145 | 146 | ||
146 | (void) cls; | 147 | (void) cls; |
147 | (void) args; | 148 | (void) args; |
@@ -236,6 +237,20 @@ run (void *cls, | |||
236 | option, | 237 | option, |
237 | value); | 238 | value); |
238 | } | 239 | } |
240 | cfg_fn = NULL; | ||
241 | if (NULL == cfgfile) | ||
242 | { | ||
243 | const char *xdg = getenv ("XDG_CONFIG_HOME"); | ||
244 | if (NULL != xdg) | ||
245 | GNUNET_asprintf (&cfg_fn, | ||
246 | "%s%s%s", | ||
247 | xdg, | ||
248 | DIR_SEPARATOR_STR, | ||
249 | GNUNET_OS_project_data_get ()->config_file); | ||
250 | else | ||
251 | cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); | ||
252 | cfgfile = cfg_fn; | ||
253 | } | ||
239 | if ( (NULL != diff) || (NULL != out) ) | 254 | if ( (NULL != diff) || (NULL != out) ) |
240 | { | 255 | { |
241 | if (GNUNET_OK != | 256 | if (GNUNET_OK != |
@@ -243,6 +258,7 @@ run (void *cls, | |||
243 | cfgfile)) | 258 | cfgfile)) |
244 | ret = 2; | 259 | ret = 2; |
245 | } | 260 | } |
261 | GNUNET_free_non_null (cfg_fn); | ||
246 | if (NULL != out) | 262 | if (NULL != out) |
247 | GNUNET_CONFIGURATION_destroy (out); | 263 | GNUNET_CONFIGURATION_destroy (out); |
248 | cleanup: | 264 | cleanup: |