shithub: rott

Download patch

ref: d7f426301f97486348cb166ead919572e22cc9b9
parent: 5f494923c36bc263db1996ec6b61b8fcc0f65c15
author: LTCHIPS <ltchips994@gmail.com>
date: Wed Jun 6 14:22:15 EDT 2018

fixed a few errors\segfaults as a result of applying C17 standard

--- a/rott/Makefile
+++ b/rott/Makefile
@@ -23,6 +23,7 @@
 
 CPPFLAGS += -DUSE_SDL=1
 CPPFLAGS += -DPLATFORM_UNIX=1
+CPPFLAGS += -D_GNU_SOURCE
 CPPFLAGS += $(EXTRACPPFLAGS)
 
 LDFLAGS += $(EXTRALDFLAGS)
--- a/rott/rt_cfg.c
+++ b/rott/rt_cfg.c
@@ -1107,7 +1107,7 @@
 
     // Write Battle File
     GetPathFromEnvironment( filename, ApogeePath, BattleName );
-    file = open( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC );
+    file = open( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR );
 
     if ( file == -1 )
     {
@@ -1463,8 +1463,10 @@
     }
 
     GetPathFromEnvironment( filename, ApogeePath, SoundName );
-    file = open ( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC );
+    file = open( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR );
 
+    //file = open ( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC );
+
     if (file == -1)
         Error ("Error opening %s: %s", filename, strerror(errno));
 
@@ -1576,7 +1578,10 @@
     WriteBattleConfig();
 
     GetPathFromEnvironment( filename, ApogeePath, ConfigName );
-    file = open( filename,O_RDWR | O_TEXT | O_CREAT | O_TRUNC );
+    
+    file = open( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR );
+
+    //file = open( filename,O_RDWR | O_TEXT | O_CREAT | O_TRUNC );
 
     if (file == -1)
         Error ("Error opening %s: %s",filename,strerror(errno));
--- a/rott/rt_main.c
+++ b/rott/rt_main.c
@@ -192,7 +192,9 @@
     FixFilePath(BATTMAPS);
     gamestate.Product = ROTT_SHAREWARE;
 #else
+    
     BATTMAPS = strdup(SITELICENSEBATTLELEVELS);
+
     FixFilePath(BATTMAPS);
     if (!access(BATTMAPS, R_OK))
     {
--- a/rott/rt_util.c
+++ b/rott/rt_util.c
@@ -550,7 +550,7 @@
     filename[sizeof (filename) - 1] = '\0';
     FixFilePath(filename);
 
-    handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND );
+    handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR );
 
     if (handle == -1)
         Error ("Error opening for append %s: %s",filename,strerror(errno));
@@ -566,7 +566,10 @@
     filename[sizeof (filename) - 1] = '\0';
     FixFilePath(filename);
 
-    handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC );
+    handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR );
+
+    
+    //handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC );
 
     if (handle == -1)
         Error ("Error opening %s: %s",filename,strerror(errno));