diff src/ui_fileops.c @ 998:d2701a5864c5

Fixed segfault when is run inside directory with non valid uft-8 image filename.
author bruclik
date Tue, 26 Aug 2008 20:21:30 +0000
parents 070bfc3591bc
children 4fe8f9656107
line wrap: on
line diff
--- a/src/ui_fileops.c	Tue Aug 26 13:56:56 2008 +0000
+++ b/src/ui_fileops.c	Tue Aug 26 20:21:30 2008 +0000
@@ -172,20 +172,16 @@
 	return path;
 }
 
-/* first we try the HOME environment var, if that doesn't work, we try getpwuid(). */
+/* first we try the HOME environment var, if that doesn't work, we try g_get_homedir(). */
 const gchar *homedir(void)
 {
 	static gchar *home = NULL;
 
 	if (!home)
-		{
 		home = path_to_utf8(getenv("HOME"));
-		}
+	
 	if (!home)
-		{
-		struct passwd *pw = getpwuid(getuid());
-		if (pw) home = path_to_utf8(pw->pw_dir);
-		}
+		home = path_to_utf8(g_get_home_dir());
 
 	return home;
 }