See if $HOME is bogus, and if so, use getpwuid() instead.
Should fully fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=553174
--- a/src/platform_posix.c Sun Mar 21 12:11:39 2010 -0400
+++ b/src/platform_posix.c Sun Mar 21 12:20:44 2010 -0400
@@ -97,8 +97,21 @@
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 */