[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Make check_private_dir trimodal (check/create/ignore), not ...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] Make check_private_dir trimodal (check/create/ignore), not ...
- From: nickm@seul.org (Nick Mathewson)
- Date: Tue, 9 Nov 2004 02:12:33 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Tue, 09 Nov 2004 02:12:58 -0500
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv16513/src/or
Modified Files:
config.c rendservice.c router.c
Log Message:
Make check_private_dir trimodal (check/create/ignore), not bimodal (create/ignore).
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.228
retrieving revision 1.229
diff -u -d -r1.228 -r1.229
--- config.c 9 Nov 2004 07:05:53 -0000 1.228
+++ config.c 9 Nov 2004 07:12:31 -0000 1.229
@@ -241,9 +241,8 @@
}
}
-/*XXX in options_validate, we should check if this is going to fail */
/* Ensure data directory is private; create if possible. */
- if (check_private_dir(options->DataDirectory, 1) != 0) {
+ if (check_private_dir(options->DataDirectory, CPD_CREATE) != 0) {
log_fn(LOG_ERR, "Couldn't access/create private data directory %s",
options->DataDirectory);
return -1;
@@ -1014,6 +1013,13 @@
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");
Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- rendservice.c 8 Nov 2004 23:12:40 -0000 1.103
+++ rendservice.c 9 Nov 2004 07:12:31 -0000 1.104
@@ -295,7 +295,7 @@
log_fn(LOG_INFO, "Loading hidden-service keys from '%s'", s->directory);
/* Check/create directory */
- if (check_private_dir(s->directory, 1) < 0)
+ if (check_private_dir(s->directory, CPD_CREATE) < 0)
return -1;
/* Load key */
Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- router.c 9 Nov 2004 07:05:53 -0000 1.113
+++ router.c 9 Nov 2004 07:12:31 -0000 1.114
@@ -259,12 +259,12 @@
}
/* Make sure DataDirectory exists, and is private. */
datadir = options->DataDirectory;
- if (check_private_dir(datadir, 1)) {
+ if (check_private_dir(datadir, CPD_CREATE)) {
return -1;
}
/* Check the key directory. */
tor_snprintf(keydir,sizeof(keydir),"%s/keys", datadir);
- if (check_private_dir(keydir, 1)) {
+ if (check_private_dir(keydir, CPD_CREATE)) {
return -1;
}
cp = keydir + strlen(keydir); /* End of string. */