diff options
author | Peter Palfrader <peter@palfrader.org> | 2008-03-10 12:41:33 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2008-03-10 12:41:33 +0000 |
commit | ded55fa296a5cb3b91cd7d1bb75fbc8d04638e25 (patch) | |
tree | ad4bbf967a6a7f8d8157ff562faccb5efbba7bd6 /src | |
parent | e8f4d79ec135e65e2108914c0b295ec7cce3e336 (diff) | |
download | tor-ded55fa296a5cb3b91cd7d1bb75fbc8d04638e25.tar.gz tor-ded55fa296a5cb3b91cd7d1bb75fbc8d04638e25.zip |
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.
svn:r13943
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/or/config.c b/src/or/config.c index 229c52fd4e..f9521c0dd4 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3642,7 +3642,7 @@ options_init_from_torrc(int argc, char **argv) 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 @@ options_init_from_torrc(int argc, char **argv) "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; |