瀏覽代碼

If DataDir is ~/.tor, and that expands to /.tor, then default to LOCALSTATEDIR/tor instead.

svn:r4170
Nick Mathewson 20 年之前
父節點
當前提交
4666b801fa
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/or/config.c

+ 4 - 1
src/or/config.c

@@ -2336,7 +2336,10 @@ normalize_data_directory(or_options_t *options) {
    if (!options->DataDirectory && !strcmp(fn,"/.tor")) {
    if (!options->DataDirectory && !strcmp(fn,"/.tor")) {
      /* If our homedir is /, we probably don't want to use it. */
      /* If our homedir is /, we probably don't want to use it. */
      /* XXXX Default to /var/lib/tor? */
      /* XXXX Default to /var/lib/tor? */
-     log_fn(LOG_WARN, "Defaulting to 'DataDirectory %s', which may not be what you want", fn);
+     log_fn(LOG_WARN, "Default DataDirectory is ~/.tor, which works out to %s, which is probably not what you want.  Using %s/tor instead", fn, LOCALSTATEDIR);
+     tor_free(fn);
+     fn = tor_strdup(LOCALSTATEDIR"/tor");
+
    }
    }
    tor_free(options->DataDirectory);
    tor_free(options->DataDirectory);
    options->DataDirectory = fn;
    options->DataDirectory = fn;