aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug37476
-rw-r--r--src/or/config.c3
-rw-r--r--src/or/connection.c3
3 files changed, 9 insertions, 3 deletions
diff --git a/changes/bug3747 b/changes/bug3747
new file mode 100644
index 000000000..052dab1bd
--- /dev/null
+++ b/changes/bug3747
@@ -0,0 +1,6 @@
+ o Major bugfixes:
+ - Write control ports to disk only after switching UID and
+ creating the data directory. This way, we don't fail when
+ starting up with a nonexistant DataDirectory and a
+ ControlPortWriteToFile setting based on that directory. Fixes
+ bug 3747; bugfix on Tor 0.2.2.26-beta. \ No newline at end of file
diff --git a/src/or/config.c b/src/or/config.c
index e0ecab2d4..7202ea254 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1034,6 +1034,9 @@ options_act_reversible(or_options_t *old_options, char **msg)
/* No need to roll back, since you can't change the value. */
}
+ /* Write control ports to disk as appropriate */
+ control_ports_write_to_file();
+
if (directory_caches_v2_dir_info(options)) {
size_t len = strlen(options->DataDirectory)+32;
char *fn = tor_malloc(len);
diff --git a/src/or/connection.c b/src/or/connection.c
index c791309d6..2049f4240 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1061,9 +1061,6 @@ connection_create_listener(const struct sockaddr *listensockaddr,
"%s listening on port %u.",
conn_type_to_string(type), gotPort);
- if (type == CONN_TYPE_CONTROL_LISTENER)
- control_ports_write_to_file();
-
conn->state = LISTENER_STATE_READY;
if (start_reading) {
connection_start_reading(conn);