aboutsummaryrefslogtreecommitdiff
path: root/src/util/program.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/program.c')
-rw-r--r--src/util/program.c72
1 files changed, 38 insertions, 34 deletions
diff --git a/src/util/program.c b/src/util/program.c
index a79e07d19..b9da14572 100644
--- a/src/util/program.c
+++ b/src/util/program.c
@@ -244,12 +244,23 @@ GNUNET_PROGRAM_run2 (int argc,
244 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 244 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
245 "Loading configuration from entry point specified as option (%s)\n", 245 "Loading configuration from entry point specified as option (%s)\n",
246 cc.cfgfile); 246 cc.cfgfile);
247 if ((GNUNET_YES != GNUNET_DISK_file_test (cc.cfgfile)) || 247 if (GNUNET_YES !=
248 (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cc.cfgfile))) 248 GNUNET_DISK_file_test (cc.cfgfile))
249 { 249 {
250 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 250 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
251 _ ( 251 _ ("Unreadable configuration file `%s', exiting ...\n"),
252 "Unreadable or malformed configuration file `%s', exit ...\n"), 252 cc.cfgfile);
253 ret = GNUNET_SYSERR;
254 GNUNET_free (allopts);
255 GNUNET_free (lpfx);
256 goto cleanup;
257 }
258 if (GNUNET_SYSERR ==
259 GNUNET_CONFIGURATION_load (cfg,
260 cc.cfgfile))
261 {
262 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
263 _ ("Malformed configuration file `%s', exiting ...\n"),
253 cc.cfgfile); 264 cc.cfgfile);
254 ret = GNUNET_SYSERR; 265 ret = GNUNET_SYSERR;
255 GNUNET_free (allopts); 266 GNUNET_free (allopts);
@@ -259,38 +270,31 @@ GNUNET_PROGRAM_run2 (int argc,
259 } 270 }
260 else 271 else
261 { 272 {
262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 273 if ( (NULL != cfg_fn) &&
263 "Loading configuration default entry point (%s)\n", 274 (GNUNET_YES !=
264 cc.cfgfile); 275 GNUNET_DISK_file_test (cfg_fn)) )
265 if ((NULL != cfg_fn) && (GNUNET_YES == GNUNET_DISK_file_test (cfg_fn)))
266 { 276 {
267 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cfg_fn)) 277 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
268 { 278 _ ("Unreadable configuration file `%s'. Exiting ...\n"),
269 GNUNET_log ( 279 cfg_fn);
270 GNUNET_ERROR_TYPE_ERROR, 280 ret = GNUNET_SYSERR;
271 _ ( 281 GNUNET_free (allopts);
272 "Unreadable or malformed default configuration file `%s', exit ...\n"), 282 GNUNET_free (lpfx);
273 cfg_fn); 283 goto cleanup;
274 ret = GNUNET_SYSERR;
275 GNUNET_free (allopts);
276 GNUNET_free (lpfx);
277 goto cleanup;
278 }
279 } 284 }
280 else if (NULL != cfg_fn) 285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
286 "Loading configuration from entry point `%s'\n",
287 cc.cfgfile);
288 if (GNUNET_SYSERR ==
289 GNUNET_CONFIGURATION_load (cfg,
290 cfg_fn))
281 { 291 {
282 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 292 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
283 "Loading configuration without entry point\n"); 293 _ ("Malformed configuration. Exiting ...\n"));
284 GNUNET_free (cfg_fn); 294 ret = GNUNET_SYSERR;
285 if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, NULL)) 295 GNUNET_free (allopts);
286 { 296 GNUNET_free (lpfx);
287 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 297 goto cleanup;
288 _ ("Unreadable or malformed configuration, exit ...\n"));
289 ret = GNUNET_SYSERR;
290 GNUNET_free (allopts);
291 GNUNET_free (lpfx);
292 goto cleanup;
293 }
294 } 298 }
295 } 299 }
296 GNUNET_free (allopts); 300 GNUNET_free (allopts);
@@ -346,7 +350,7 @@ GNUNET_PROGRAM_run2 (int argc,
346 cc.task (cc.task_cls, cc.args, cc.cfgfile, cc.cfg); 350 cc.task (cc.task_cls, cc.args, cc.cfgfile, cc.cfg);
347 } 351 }
348 ret = GNUNET_OK; 352 ret = GNUNET_OK;
349 cleanup: 353cleanup:
350 GNUNET_CONFIGURATION_destroy (cfg); 354 GNUNET_CONFIGURATION_destroy (cfg);
351 GNUNET_free (cc.cfgfile); 355 GNUNET_free (cc.cfgfile);
352 GNUNET_free (cfg_fn); 356 GNUNET_free (cfg_fn);