From 870d3661390e50de8d5d9444477c10c8d7929a77 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 15 Feb 2013 21:08:47 -0600 Subject: 5717 - Gamecode can open file "" for reading --- src/sys/sys_unix.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/sys/sys_unix.c') diff --git a/src/sys/sys_unix.c b/src/sys/sys_unix.c index b05cf855..7660edd1 100644 --- a/src/sys/sys_unix.c +++ b/src/sys/sys_unix.c @@ -185,6 +185,21 @@ const char *Sys_Dirname( char *path ) return dirname( path ); } +/* +============== +Sys_FOpen +============== +*/ +FILE *Sys_FOpen( const char *ospath, const char *mode ) { + struct stat buf; + + // check if path exists and is a directory + if ( !stat( ospath, &buf ) && S_ISDIR( buf.st_mode ) ) + return NULL; + + return fopen( ospath, mode ); +} + /* ================== Sys_Mkdir -- cgit