[or-cvs] once normalized, DataDirectory is always defined
Roger Dingledine
arma at seul.org
Tue Nov 9 07:20:24 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
config.c dirserv.c
Log Message:
once normalized, DataDirectory is always defined
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -d -r1.229 -r1.230
--- config.c 9 Nov 2004 07:12:31 -0000 1.229
+++ config.c 9 Nov 2004 07:20:21 -0000 1.230
@@ -1013,13 +1013,6 @@
if (normalize_log_options(options))
return -1;
-
- if (options->DataDirectory &&
- check_private_dir(options->DataDirectory, CPD_CHECK != 0)) {
- log_fn(LOG_WARN, "Can't create directory %s", options->DataDirectory);
- result = -1;
- }
-
/* Special case if no options are given. */
if (!options->Logs) {
options->Logs = config_line_prepend(NULL, "Log", "notice-err stdout");
@@ -1237,10 +1230,7 @@
return -1;
}
- if ((old->DataDirectory &&
- (!new_val->DataDirectory ||
- strcmp(old->DataDirectory,new_val->DataDirectory)!=0)) ||
- (!old->DataDirectory && new_val->DataDirectory)) {
+ if (strcmp(old->DataDirectory,new_val->DataDirectory)!=0) {
log_fn(LOG_WARN,"During reload, changing DataDirectory (%s->%s) is not allowed. Failing.", old->DataDirectory, new_val->DataDirectory);
return -1;
}
@@ -1879,13 +1869,17 @@
static int
validate_data_directory(or_options_t *options) {
- if(normalize_data_directory(options) < 0)
+ if (normalize_data_directory(options) < 0)
return -1;
tor_assert(options->DataDirectory);
if (strlen(options->DataDirectory) > (512-128)) {
log_fn(LOG_ERR, "DataDirectory is too long.");
return -1;
}
+ if (check_private_dir(options->DataDirectory, CPD_CHECK != 0)) {
+ log_fn(LOG_WARN, "Can't create directory %s", options->DataDirectory);
+ return -1;
+ }
return 0;
}
Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- dirserv.c 9 Nov 2004 07:05:53 -0000 1.113
+++ dirserv.c 9 Nov 2004 07:20:21 -0000 1.114
@@ -711,11 +711,9 @@
log_fn(LOG_WARN,"Error compressing cached directory");
}
cached_directory_published = when;
- if(get_options()->DataDirectory) {
- tor_snprintf(filename,sizeof(filename),"%s/cached-directory", get_options()->DataDirectory);
- if(write_str_to_file(filename,cached_directory,0) < 0) {
- log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring.");
- }
+ tor_snprintf(filename,sizeof(filename),"%s/cached-directory", get_options()->DataDirectory);
+ if(write_str_to_file(filename,cached_directory,0) < 0) {
+ log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring.");
}
}
}
More information about the tor-commits
mailing list