aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-02-06 18:36:21 +0000
committerNick Mathewson <nickm@torproject.org>2007-02-06 18:36:21 +0000
commitf4a1c17e5ab5e4a6596eb34b926d595f966f8f6b (patch)
treed85f0d741ff36aefbb07dbeff7949d1107cc9d6e /src
parent0c4ab00658cc33e893c4b402ddc81d083338bbd4 (diff)
downloadtor-f4a1c17e5ab5e4a6596eb34b926d595f966f8f6b.tar
tor-f4a1c17e5ab5e4a6596eb34b926d595f966f8f6b.tar.gz
r11666@catbus: nickm | 2007-02-06 13:17:24 -0500
Implement an --ignore-missing-torrc option svn:r9501
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c
index eb6cdaf29..962752cf0 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1075,7 +1075,8 @@ config_get_commandlines(int argc, char **argv, config_line_t **result)
i += 2; /* command-line option with argument. ignore them. */
continue;
} else if (!strcmp(argv[i],"--list-fingerprint") ||
- !strcmp(argv[i],"--verify-config")) {
+ !strcmp(argv[i],"--verify-config") ||
+ !strcmp(argv[i],"--ignore-missing-torrc")) {
i += 1; /* command-line option. ignore it. */
continue;
} else if (!strcmp(argv[i],"--nt-service") ||
@@ -2967,6 +2968,7 @@ options_init_from_torrc(int argc, char **argv)
char *cf=NULL, *fname=NULL, *errmsg=NULL;
int i, retval;
int using_default_torrc;
+ int ignore_missing_torrc;
static char **backup_argv;
static int backup_argc;
@@ -3004,6 +3006,7 @@ options_init_from_torrc(int argc, char **argv)
/* learn config file name */
fname = NULL;
using_default_torrc = 1;
+ ignore_missing_torrc = 0;
newoptions->command = CMD_RUN_TOR;
for (i = 1; i < argc; ++i) {
if (i < argc-1 && !strcmp(argv[i],"-f")) {
@@ -3014,6 +3017,8 @@ options_init_from_torrc(int argc, char **argv)
fname = tor_strdup(argv[i+1]);
using_default_torrc = 0;
++i;
+ } else if (!strcmp(argv[i],"--ignore-missing-torrc")) {
+ ignore_missing_torrc = 1;
} else if (!strcmp(argv[i],"--list-fingerprint")) {
newoptions->command = CMD_LIST_FINGERPRINT;
} else if (!strcmp(argv[i],"--hash-password")) {
@@ -3053,7 +3058,7 @@ options_init_from_torrc(int argc, char **argv)
/* get config lines, assign them */
if (file_status(fname) != FN_FILE ||
!(cf = read_file_to_str(fname,0,NULL))) {
- if (using_default_torrc == 1) {
+ if (using_default_torrc == 1 || ignore_missing_torrc ) {
log(LOG_NOTICE, LD_CONFIG, "Configuration file \"%s\" not present, "
"using reasonable defaults.", fname);
tor_free(fname); /* sets fname to NULL */