See if $HOME is bogus, and if so, use getpwuid() instead.
Should fully fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=553174
This commit is contained in:
parent
72b232d4f5
commit
efa498fd5d
|
@ -97,8 +97,21 @@ char *__PHYSFS_platformGetUserName(void)
|
|||
char *__PHYSFS_platformGetUserDir(void)
|
||||
{
|
||||
char *retval = __PHYSFS_platformCopyEnvironmentVariable("HOME");
|
||||
|
||||
/* if the environment variable was set, make sure it's really a dir. */
|
||||
if (retval != NULL)
|
||||
{
|
||||
struct stat statbuf;
|
||||
if ((stat(retval, &statbuf) == -1) || (S_ISDIR(statbuf.st_mode) == 0))
|
||||
{
|
||||
allocator.Free(retval);
|
||||
retval = NULL;
|
||||
} /* if */
|
||||
} /* if */
|
||||
|
||||
if (retval == NULL)
|
||||
retval = getUserDirByUID();
|
||||
|
||||
return retval;
|
||||
} /* __PHYSFS_platformGetUserDir */
|
||||
|
||||
|
|
Loading…
Reference in New Issue