aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2016-11-02 14:10:52 +1100
committerteor <teor2345@gmail.com>2016-11-02 14:10:52 +1100
commita906ff88a3660ff689a2bd630836b74d70a1ce6c (patch)
tree5027036945cabb1f74030ed5d56bca287f4c8d20
parentfedafe7c0eb9eda0d11dd1b5ba37b7faff625c88 (diff)
downloadtor-a906ff88a3660ff689a2bd630836b74d70a1ce6c.tar.gz
tor-a906ff88a3660ff689a2bd630836b74d70a1ce6c.zip
fixup! Refactor, adding a create argument to rend_service_check_private_dir
-rw-r--r--src/or/rendservice.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index dca775e041..6743d825b5 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -1246,17 +1246,23 @@ rend_service_derive_key_digests(struct rend_service_t *s)
return 0;
}
-/** Make sure that the directory for <b>s</b> is private. If <b>create</b> is
- * true, if it exists, change permissions if needed, otherwise, create it with
- * the correct permissions. Otherwise, if <b>create</b> is false and the
- * directory does not exist, check if we think we can create it.
+/** Make sure that the directory for <b>s</b> is private.
+ * If <b>create</b> is true:
+ * - if the directory exists, change permissions if needed,
+ * - if the directory does not exist, create it with the correct permissions.
+ * If <b>create</b> is false:
+ * - if the directory exists, check permissions,
+ * - if the directory does not exist, check if we think we can create it.
* Return 0 on success, -1 on failure. */
static int
rend_service_check_private_dir(const rend_service_t *s, int create)
{
- cpd_check_t check_opts = CPD_CREATE;
- if (!create) {
+ cpd_check_t check_opts = CPD_NONE;
+ if (create) {
+ check_opts |= CPD_CREATE;
+ } else {
check_opts |= CPD_CHECK_MODE_ONLY;
+ check_opts |= CPD_CHECK;
}
if (s->dir_group_readable) {
check_opts |= CPD_GROUP_READ;