Fix compilation on Android with the bionic C library

https://bugzilla.gnome.org/show_bug.cgi?id=689223
This commit is contained in:
Sebastian Dröge
2012-11-28 16:55:54 +01:00
parent 5e2cad9de9
commit bcbaf1bef0
11 changed files with 349 additions and 27 deletions

View File

@@ -743,14 +743,19 @@ g_get_user_database_entry (void)
if (!pw)
{
#ifndef __BIONIC__
setpwent ();
#endif
pw = getpwuid (getuid ());
#ifndef __BIONIC__
endpwent ();
#endif
}
if (pw)
{
e.user_name = g_strdup (pw->pw_name);
#ifndef __BIONIC__
if (pw->pw_gecos && *pw->pw_gecos != '\0')
{
gchar **gecos_fields;
@@ -764,6 +769,7 @@ g_get_user_database_entry (void)
g_strfreev (gecos_fields);
g_strfreev (name_parts);
}
#endif
if (!e.home_dir)
e.home_dir = g_strdup (pw->pw_dir);