[or-cvs] r13943: options_init_from_torrc(): tread non-existing torrc like emp (tor/trunk/src/or)
weasel at seul.org
weasel at seul.org
Mon Mar 10 12:41:33 UTC 2008
Author: weasel
Date: 2008-03-10 08:41:33 -0400 (Mon, 10 Mar 2008)
New Revision: 13943
Modified:
tor/trunk/src/or/config.c
Log:
options_init_from_torrc(): tread non-existing torrc like empty torrc.
Tread the case of a non-existing conffile, when allowed, exactly like the one
with an empty torrc.
Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c 2008-03-10 12:41:29 UTC (rev 13942)
+++ tor/trunk/src/or/config.c 2008-03-10 12:41:33 UTC (rev 13943)
@@ -3642,7 +3642,7 @@
tor_free(torrc_fname);
torrc_fname = fname;
- /* get config lines, assign them */
+ /* Open config file */
if (file_status(fname) != FN_FILE ||
!(cf = read_file_to_str(fname,0,NULL))) {
if (using_default_torrc == 1 || ignore_missing_torrc ) {
@@ -3650,22 +3650,24 @@
"using reasonable defaults.", fname);
tor_free(fname); /* sets fname to NULL */
torrc_fname = NULL;
+ cf = tor_strdup("");
} else {
log(LOG_WARN, LD_CONFIG,
"Unable to open configuration file \"%s\".", fname);
goto err;
}
- } else { /* it opened successfully. use it. */
- retval = config_get_lines(cf, &cl);
- tor_free(cf);
- if (retval < 0)
- goto err;
- retval = config_assign(&options_format, newoptions, cl, 0, 0, &errmsg);
- config_free_lines(cl);
- if (retval < 0)
- goto err;
}
+ /* get config lines, assign them */
+ retval = config_get_lines(cf, &cl);
+ tor_free(cf);
+ if (retval < 0)
+ goto err;
+ retval = config_assign(&options_format, newoptions, cl, 0, 0, &errmsg);
+ config_free_lines(cl);
+ if (retval < 0)
+ goto err;
+
/* Go through command-line variables too */
if (config_get_commandlines(argc, argv, &cl) < 0)
goto err;
More information about the tor-commits
mailing list