[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master 1/2] Treat unset $HOME like empty $HOME



Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Mon, 7 Jun 2010 02:18:01 +0200
Subject: Treat unset $HOME like empty $HOME
Commit: 0882e1e839d5023fc6f0dbd11eb6e45236f3dc75

This means Tor no longer dies when it doesn't have a $HOME.
---
 changes/bug1522   |    3 +++
 src/common/util.c |   10 ++++------
 2 files changed, 7 insertions(+), 6 deletions(-)
 create mode 100644 changes/bug1522

diff --git a/changes/bug1522 b/changes/bug1522
new file mode 100644
index 0000000..e120913
--- /dev/null
+++ b/changes/bug1522
@@ -0,0 +1,3 @@
+ o Minor bugfixes
+   - Treat an unset $HOME like an empty $HOME. Fixes bug 1522; bugfix on
+     tor-0.0.8pre1.
diff --git a/src/common/util.c b/src/common/util.c
index fe48e93..748e23b 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -2323,12 +2323,10 @@ expand_filename(const char *filename)
 
     if (filename[1] == '/' || filename[1] == '\0') {
       home = getenv("HOME");
-      if (!home) {
-        log_warn(LD_CONFIG, "Couldn't find $HOME environment variable while "
-                 "expanding \"%s\"", filename);
-        return NULL;
-      }
-      home = tor_strdup(home);
+      if (!home)
+        home = tor_strdup("");
+      else
+        home = tor_strdup(home);
       rest = strlen(filename)>=2?(filename+2):"";
     } else {
 #ifdef HAVE_PWD_H
-- 
1.6.5