Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -93,24 +93,29 @@ get_pw_data (void)
pthread_mutex_unlock (&pw_lock);
return;
}
home_dir = g_getenv ("HOME");
user_name = g_getenv ("USER");
#ifdef HAVE_GETPWUID_R
if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
home_dir = g_strdup (pw.pw_dir);
user_name = g_strdup (pw.pw_name);
if (home_dir == NULL || user_name == NULL) {
if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
if (home_dir == NULL)
home_dir = g_strdup (pw.pw_dir);
if (user_name == NULL)
user_name = g_strdup (pw.pw_name);
}
}
#endif
if (home_dir == NULL)
home_dir = g_getenv ("HOME");
if (user_name == NULL) {
user_name = g_getenv ("USER");
if (user_name == NULL)
user_name = "somebody";
}
if (user_name == NULL)
user_name = "somebody";
if (home_dir == NULL)
home_dir = "/";
pthread_mutex_unlock (&pw_lock);
}
/* Give preference to /etc/passwd than HOME */
const gchar *
g_get_home_dir (void)
{