diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-11-14 16:18:53 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-05 19:49:28 -0500 |
commit | 7b34ab3e384b5c72e938d11e5e05c72b9d529bb8 (patch) | |
tree | 58bfece83dc694baf4e75a9127a1c7371e589824 /src/or/router.c | |
parent | 2e872f6b32edaace096180c249934c620cd3ce35 (diff) | |
download | tor-7b34ab3e384b5c72e938d11e5e05c72b9d529bb8.tar.gz tor-7b34ab3e384b5c72e938d11e5e05c72b9d529bb8.zip |
Extract common code for creating the keys directory.
This had somehow gotten duplicated between router.c and routerkeys.c
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/or/router.c b/src/or/router.c index 8ad5d038ef..fb8596a8d9 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -932,22 +932,9 @@ init_keys(void) } if (init_keys_common() < 0) return -1; - /* Make sure DataDirectory exists, and is private. */ - cpd_check_t cpd_opts = CPD_CREATE; - if (options->DataDirectoryGroupReadable) - cpd_opts |= CPD_GROUP_READ; - if (check_private_dir(options->DataDirectory, cpd_opts, options->User)) { - log_err(LD_OR, "Can't create/check datadirectory %s", - options->DataDirectory); - return -1; - } - /* Check the key directory. */ - keydir = get_datadir_fname("keys"); - if (check_private_dir(keydir, CPD_CREATE, options->User)) { - tor_free(keydir); + + if (create_keys_directory(options) < 0) return -1; - } - tor_free(keydir); /* 1a. Read v3 directory authority key/cert information. */ memset(v3_digest, 0, sizeof(v3_digest)); |