r10849 - in packages/trunk/libphysfs/debian: . patches

Patrick Matthäi pmatthaei at alioth.debian.org
Sun Mar 21 17:08:19 UTC 2010


Author: pmatthaei
Date: 2010-03-21 17:08:16 +0000 (Sun, 21 Mar 2010)
New Revision: 10849

Added:
   packages/trunk/libphysfs/debian/patches/04_fix-bogus-homedir.diff
Modified:
   packages/trunk/libphysfs/debian/changelog
   packages/trunk/libphysfs/debian/patches/series
Log:
* Add patch 04_fix-bogus-homedir.diff from upstream.
  Closes: #553174


Modified: packages/trunk/libphysfs/debian/changelog
===================================================================
--- packages/trunk/libphysfs/debian/changelog	2010-03-18 00:49:22 UTC (rev 10848)
+++ packages/trunk/libphysfs/debian/changelog	2010-03-21 17:08:16 UTC (rev 10849)
@@ -1,3 +1,10 @@
+libphysfs (2.0.0-6) UNRELEASED; urgency=low
+
+  * Add patch 04_fix-bogus-homedir.diff from upstream.
+    Closes: #553174
+
+ -- Patrick Matthäi <pmatthaei at debian.org>  Sun, 21 Mar 2010 18:06:42 +0100
+
 libphysfs (2.0.0-5) unstable; urgency=high
 
   * Bump Standards-Version to 3.8.4 (no changes needed).

Added: packages/trunk/libphysfs/debian/patches/04_fix-bogus-homedir.diff
===================================================================
--- packages/trunk/libphysfs/debian/patches/04_fix-bogus-homedir.diff	                        (rev 0)
+++ packages/trunk/libphysfs/debian/patches/04_fix-bogus-homedir.diff	2010-03-21 17:08:16 UTC (rev 10849)
@@ -0,0 +1,74 @@
+# Patch from upstream, to fix an error with a bogus $HOME variable.
+# Closes: #553174
+
+diff -Naur libphysfs-2.0.0.orig//physfs.c libphysfs-2.0.0/physfs.c
+--- libphysfs-2.0.0.orig//physfs.c	2009-03-23 06:13:28.000000000 +0100
++++ libphysfs-2.0.0/physfs.c	2010-03-21 18:00:53.000000000 +0100
+@@ -605,18 +605,21 @@
+ 
+ static char *calculateUserDir(void)
+ {
+-    char *retval = NULL;
+-    const char *str = NULL;
++    char *retval = __PHYSFS_platformGetUserDir();
++    if (retval != NULL)
++    {
++        /* make sure it really exists and is normalized. */
++        char *ptr = __PHYSFS_platformRealPath(retval);
++        allocator.Free(retval);
++        retval = ptr;
++    } /* if */
+ 
+-    str = __PHYSFS_platformGetUserDir();
+-    if (str != NULL)
+-        retval = (char *) str;
+-    else
++    if (retval == NULL)
+     {
+         const char *dirsep = PHYSFS_getDirSeparator();
+         const char *uname = __PHYSFS_platformGetUserName();
++        const char *str = (uname != NULL) ? uname : "default";
+ 
+-        str = (uname != NULL) ? uname : "default";
+         retval = (char *) allocator.Malloc(strlen(baseDir) + strlen(str) +
+                                            strlen(dirsep) + 6);
+ 
+@@ -754,13 +757,6 @@
+     BAIL_IF_MACRO(!appendDirSep(&baseDir), NULL, 0);
+ 
+     userDir = calculateUserDir();
+-    if (userDir != NULL)
+-    {
+-        ptr = __PHYSFS_platformRealPath(userDir);
+-        allocator.Free(userDir);
+-        userDir = ptr;
+-    } /* if */
+-
+     if ((userDir == NULL) || (!appendDirSep(&userDir)))
+     {
+         allocator.Free(baseDir);
+diff -Naur libphysfs-2.0.0.orig//platform/posix.c libphysfs-2.0.0/platform/posix.c
+--- libphysfs-2.0.0.orig//platform/posix.c	2009-03-23 06:13:28.000000000 +0100
++++ libphysfs-2.0.0/platform/posix.c	2010-03-21 18:00:53.000000000 +0100
+@@ -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 */
+ 

Modified: packages/trunk/libphysfs/debian/patches/series
===================================================================
--- packages/trunk/libphysfs/debian/patches/series	2010-03-18 00:49:22 UTC (rev 10848)
+++ packages/trunk/libphysfs/debian/patches/series	2010-03-21 17:08:16 UTC (rev 10849)
@@ -1,3 +1,4 @@
 01_manpages.diff
 02_fix-hurd-ftbfs.diff
 03_gcc4.4-ftbfs.diff
+04_fix-bogus-homedir.diff




More information about the Pkg-games-commits mailing list