[quake3-commits] r1937 - in trunk/code: qcommon sys

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Mar 30 17:58:31 EDT 2011


Author: tma
Date: 2011-03-30 17:58:31 -0400 (Wed, 30 Mar 2011)
New Revision: 1937

Modified:
   trunk/code/qcommon/files.c
   trunk/code/sys/sys_unix.c
Log:
* Crash recovery for com_pipeFile (Lakitu7)

Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c	2011-03-17 16:00:45 UTC (rev 1936)
+++ trunk/code/qcommon/files.c	2011-03-30 21:58:31 UTC (rev 1937)
@@ -943,6 +943,8 @@
 	}
 	else
 	{
+		Com_Printf( S_COLOR_YELLOW "WARNING: Could not create new com_pipefile at %s. "
+			"com_pipefile will not be used.\n", ospath );
 		f = 0;
 	}
 

Modified: trunk/code/sys/sys_unix.c
===================================================================
--- trunk/code/sys/sys_unix.c	2011-03-17 16:00:45 UTC (rev 1936)
+++ trunk/code/sys/sys_unix.c	2011-03-30 21:58:31 UTC (rev 1937)
@@ -254,10 +254,15 @@
 */
 FILE *Sys_Mkfifo( const char *ospath )
 {
-	FILE	*fifo; 
-	int		result;
-	int		fn;
+	FILE	*fifo;
+	int	result;
+	int	fn;
+	struct	stat buf;
 
+	// if file already exists AND is a pipefile, remove it
+	if( !stat( ospath, &buf ) && S_ISFIFO( buf.st_mode ) )
+		FS_Remove( ospath );
+
 	result = mkfifo( ospath, 0600 );
 	if( result != 0 )
 		return NULL;



More information about the quake3-commits mailing list