aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug31356
-rw-r--r--src/or/config.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/changes/bug3135 b/changes/bug3135
new file mode 100644
index 000000000..d76112348
--- /dev/null
+++ b/changes/bug3135
@@ -0,0 +1,6 @@
+ o Minor bugfixes
+ - Do not crash when our configuration file becomes unreadable
+ (usually due to a permissions change) between when we start
+ up and when a controller calls SAVECONF. Fixes bug 3135;
+ bugfix on 0.0.9pre6.
+
diff --git a/src/or/config.c b/src/or/config.c
index 5b251d382..d17ed2462 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -4764,7 +4764,7 @@ write_configuration_file(const char *fname, or_options_t *options)
switch (file_status(fname)) {
case FN_FILE:
old_val = read_file_to_str(fname, 0, NULL);
- if (strcmpstart(old_val, GENERATED_FILE_PREFIX)) {
+ if (!old_val || strcmpstart(old_val, GENERATED_FILE_PREFIX)) {
rename_old = 1;
}
tor_free(old_val);