diff options
Diffstat (limited to 'src/util/configuration.c')
-rw-r--r-- | src/util/configuration.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c index 09a3a7d93..d9d6721cc 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -2383,31 +2383,34 @@ GNUNET_CONFIGURATION_default (void) | |||
2383 | char *cfgname = NULL; | 2383 | char *cfgname = NULL; |
2384 | struct GNUNET_CONFIGURATION_Handle *cfg; | 2384 | struct GNUNET_CONFIGURATION_Handle *cfg; |
2385 | 2385 | ||
2386 | /* FIXME: Why are we doing this? Needs some commentary! */ | 2386 | /* Makes sure function implicitly looking at the installation directory (for |
2387 | example GNUNET_CONFIGURATION_load further down) use GNUnet's environment | ||
2388 | instead of the caller's. It's done at the start to make sure as many | ||
2389 | functions as possible are directed to the proper paths. */ | ||
2387 | GNUNET_OS_init (dpd); | 2390 | GNUNET_OS_init (dpd); |
2388 | 2391 | ||
2389 | cfg = GNUNET_CONFIGURATION_create (); | 2392 | cfg = GNUNET_CONFIGURATION_create (); |
2390 | 2393 | ||
2391 | /* First, try user configuration. */ | 2394 | /* First, try user configuration. */ |
2392 | if (NULL != xdg) | 2395 | if (NULL != xdg) |
2393 | GNUNET_asprintf (&cfgname, "%s/%s", xdg, pd->config_file); | 2396 | GNUNET_asprintf (&cfgname, "%s/%s", xdg, dpd->config_file); |
2394 | else | 2397 | else |
2395 | cfgname = GNUNET_strdup (pd->user_config_file); | 2398 | cfgname = GNUNET_strdup (dpd->user_config_file); |
2396 | 2399 | ||
2397 | /* If user config doesn't exist, try in | 2400 | /* If user config doesn't exist, try in |
2398 | /etc/<projdir>/<cfgfile> and /etc/<cfgfile> */ | 2401 | /etc/<projdir>/<cfgfile> and /etc/<cfgfile> */ |
2399 | if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) | 2402 | if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) |
2400 | { | 2403 | { |
2401 | GNUNET_free (cfgname); | 2404 | GNUNET_free (cfgname); |
2402 | GNUNET_asprintf (&cfgname, "/etc/%s", pd->config_file); | 2405 | GNUNET_asprintf (&cfgname, "/etc/%s", dpd->config_file); |
2403 | } | 2406 | } |
2404 | if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) | 2407 | if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) |
2405 | { | 2408 | { |
2406 | GNUNET_free (cfgname); | 2409 | GNUNET_free (cfgname); |
2407 | GNUNET_asprintf (&cfgname, | 2410 | GNUNET_asprintf (&cfgname, |
2408 | "/etc/%s/%s", | 2411 | "/etc/%s/%s", |
2409 | pd->project_dirname, | 2412 | dpd->project_dirname, |
2410 | pd->config_file); | 2413 | dpd->config_file); |
2411 | } | 2414 | } |
2412 | if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) | 2415 | if (GNUNET_OK != GNUNET_DISK_file_test (cfgname)) |
2413 | { | 2416 | { |