rpms/lincity-ng/devel lincity-ng-1.92.beta-fix-f9-crash.patch, NONE, 1.1 lincity-ng.spec, 1.16, 1.17

Tom Callaway spot at fedoraproject.org
Thu Sep 25 20:39:30 UTC 2008


Author: spot

Update of /cvs/extras/rpms/lincity-ng/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28136/devel

Modified Files:
	lincity-ng.spec 
Added Files:
	lincity-ng-1.92.beta-fix-f9-crash.patch 
Log Message:
fix crash in f9 due to PHYSFS_getRealDir(file) trying to assign NULL to a std::string

lincity-ng-1.92.beta-fix-f9-crash.patch:

--- NEW FILE lincity-ng-1.92.beta-fix-f9-crash.patch ---
diff -up lincity-ng-1.92.beta/src/lincity-ng/MainLincity.cpp.BAD lincity-ng-1.92.beta/src/lincity-ng/MainLincity.cpp
--- lincity-ng-1.92.beta/src/lincity-ng/MainLincity.cpp.BAD	2008-09-25 15:39:36.000000000 -0400
+++ lincity-ng-1.92.beta/src/lincity-ng/MainLincity.cpp	2008-09-25 16:27:46.000000000 -0400
@@ -110,8 +110,15 @@ void saveCityNG( std::string newFilename
  * Load City and do setup for Lincity NG.
  */
 bool loadCityNG( std::string filename ){
+    std::string dir = "";
     /* FIXME crash on debian etch when 9_currentGameNG.scn does not exist */
-    std::string dir = PHYSFS_getRealDir(filename.c_str());
+    /* If PHYSFS_getRealDir doesn't find the file, it returns NULL. */
+    /* This causes a crash when trying to assign NULL to a std::string. */
+    if ( ! PHYSFS_getRealDir(filename.c_str()) ) {
+	return false;
+    } else {
+	dir = PHYSFS_getRealDir(filename.c_str());
+    }
     filename = dir + PHYSFS_getDirSeparator() + filename;
     if( file_exists( const_cast<char*>( filename.c_str()) ) ){
         load_city_2(const_cast<char*>(filename.c_str()));


Index: lincity-ng.spec
===================================================================
RCS file: /cvs/extras/rpms/lincity-ng/devel/lincity-ng.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- lincity-ng.spec	23 Sep 2008 15:28:03 -0000	1.16
+++ lincity-ng.spec	25 Sep 2008 20:39:00 -0000	1.17
@@ -1,11 +1,12 @@
 Name:		lincity-ng
 Version:	1.92
-Release:	0.2.beta%{?dist}
+Release:	0.3.beta%{?dist}
 License:	GPLv2+
 Group:		Amusements/Games
 Summary:	City Simulation Game
 URL:		http://lincity-ng.berlios.de/
 Source0:	http://download.berlios.de/lincity-ng/lincity-ng-%{version}.beta.tar.bz2
+Patch0:		lincity-ng-1.92.beta-fix-f9-crash.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:	jam, physfs-devel, zlib-devel, libxml2-devel
 BuildRequires:	SDL-devel, SDL_mixer-devel, SDL_image-devel, SDL_gfx-devel
@@ -31,6 +32,7 @@
 
 %prep
 %setup -q -n %{name}-%{version}.beta
+%patch0 -p1 -b .fix-f9-crash
 sed -i "s/CFLAGS += -O3 -g -Wall/CFLAGS += $RPM_OPT_FLAGS/" Jamrules
 sed -i "s/CXXFLAGS += -O3 -g -Wall/CXXFLAGS += $RPM_OPT_FLAGS/" Jamrules
 sed -i 's|lincity-ng.png|lincity-ng|g' lincity-ng.desktop
@@ -65,6 +67,9 @@
 %{_datadir}/lincity-ng/
 
 %changelog
+* Thu Sep 25 2008 Tom "spot" Callaway <tcallawa at redhat.com> 1.92-0.3.beta
+- fix f9 crash (upstream bug #14544)
+
 * Tue Sep 23 2008 Tom "spot" Callaway <tcallawa at redhat.com> 1.92-0.2.beta
 - fix typo in spec file
 




More information about the fedora-extras-commits mailing list