[tracker] respect HOME over the value in /etc/passwd



commit e3a91211e44584151c6f9085f41f87d736dc05e9
Author: Saleem Abdulrasool <compnerd compnerd org>
Date:   Mon Oct 5 18:42:12 2009 -0700

    respect HOME over the value in /etc/passwd
    
    g_get_homedir does not respect the value of HOME.  Explicitly check the value of
    HOME, and if it is set, it takes precedence over the value in /etc/passwd.  If
    it is unset, we fall back to the value in /etc/passwd.

 src/libtracker-common/tracker-file-utils.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-common/tracker-file-utils.c b/src/libtracker-common/tracker-file-utils.c
index d9cc084..2eac645 100644
--- a/src/libtracker-common/tracker-file-utils.c
+++ b/src/libtracker-common/tracker-file-utils.c
@@ -500,7 +500,12 @@ tracker_path_evaluate_name (const gchar *path)
 
 	/* First check the simple case of using tilder */
 	if (path[0] == '~') {
-		const char *home = g_get_home_dir ();
+		const gchar *home;
+
+		home = g_getenv ("HOME");
+		if (! home) {
+			home = g_get_home_dir ();
+		}
 
 		if (!home || home[0] == '\0') {
 			return NULL;



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