[tor-commits] [tor/maint-0.2.2] Make the Log configuration option expand ~

nickm at torproject.org nickm at torproject.org
Mon Apr 25 23:03:05 UTC 2011


commit 91aa6f08bcf0acbdfa038aaffe73e327ddd87c67
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Fri Apr 22 16:06:52 2011 +0200

    Make the Log configuration option expand ~
---
 changes/bug2971 |    6 ++++++
 src/or/config.c |    4 +++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/changes/bug2971 b/changes/bug2971
new file mode 100644
index 0000000..8b71ce0
--- /dev/null
+++ b/changes/bug2971
@@ -0,0 +1,6 @@
+  o Minor bugfixes:
+    - Be more consistent in our treatment of file system paths. ~ should
+      get expanded to the user's home directory in the Log config option.
+      Bugfix on 0.2.0.1-alpha, which introduced the feature for the -f and
+      --DataDirectory options.
+
diff --git a/src/or/config.c b/src/or/config.c
index 5000f5d..3770301 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -4382,11 +4382,13 @@ options_init_logs(or_options_t *options, int validate_only)
     if (smartlist_len(elts) == 2 &&
         !strcasecmp(smartlist_get(elts,0), "file")) {
       if (!validate_only) {
-        if (add_file_log(severity, smartlist_get(elts, 1)) < 0) {
+        char *fname = expand_filename(smartlist_get(elts, 1));
+        if (add_file_log(severity, fname) < 0) {
           log_warn(LD_CONFIG, "Couldn't open file for 'Log %s': %s",
                    opt->value, strerror(errno));
           ok = 0;
         }
+        tor_free(fname);
       }
       goto cleanup;
     }





More information about the tor-commits mailing list