summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2013-02-15 21:08:47 -0600
committerTim Angus <tim@ngus.net>2013-02-16 21:58:25 +0000
commit870d3661390e50de8d5d9444477c10c8d7929a77 (patch)
treeb5d9c96ae3a82fa7ee7aeafa7aeda48c3d525842 /src/sys
parent04c8f48d8363b80540a3ce057908413b4479c92b (diff)
5717 - Gamecode can open file "" for reading
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/sys_unix.c15
-rw-r--r--src/sys/sys_win32.c9
2 files changed, 24 insertions, 0 deletions
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
@@ -186,6 +186,21 @@ const char *Sys_Dirname( char *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
==================
diff --git a/src/sys/sys_win32.c b/src/sys/sys_win32.c
index 45741a5d..fc5a399e 100644
--- a/src/sys/sys_win32.c
+++ b/src/sys/sys_win32.c
@@ -281,6 +281,15 @@ const char *Sys_Dirname( char *path )
/*
==============
+Sys_FOpen
+==============
+*/
+FILE *Sys_FOpen( const char *ospath, const char *mode ) {
+ return fopen( ospath, mode );
+}
+
+/*
+==============
Sys_Mkdir
==============
*/