summaryrefslogtreecommitdiff
path: root/apps/plugins/doom
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/doom')
-rw-r--r--apps/plugins/doom/rockdoom.c13
-rw-r--r--apps/plugins/doom/rockmacros.h6
2 files changed, 13 insertions, 6 deletions
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 21efbc4147..1383a2b520 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -63,13 +63,20 @@ int fileexists(const char * fname)
63} 63}
64 64
65#ifndef SIMULATOR 65#ifndef SIMULATOR
66int my_open(const char *file, int flags) 66int my_open(const char *file, int flags, ...)
67{ 67{
68 if(fpoint==8) 68 if(fpoint==8)
69 return -1; 69 return -1;
70#undef open 70#undef open
71 filearray[fpoint]=rb->open(file, flags); 71 if (flags & O_CREAT)
72 72 {
73 va_list ap;
74 va_start(ap, flags);
75 filearray[fpoint]=rb->open(file, flags, va_arg(ap, mode_t));
76 va_end(ap);
77 }
78 else
79 filearray[fpoint]=rb->open(file, flags);
73 if(filearray[fpoint]<0) 80 if(filearray[fpoint]<0)
74 return filearray[fpoint]; 81 return filearray[fpoint];
75 82
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h
index 98f908dc1d..e066fe861c 100644
--- a/apps/plugins/doom/rockmacros.h
+++ b/apps/plugins/doom/rockmacros.h
@@ -39,12 +39,12 @@ char *my_strtok( char * s, const char * delim );
39#define read_line(a,b,c) rb->read_line((a),(b),(c)) 39#define read_line(a,b,c) rb->read_line((a),(b),(c))
40 40
41#ifdef SIMULATOR 41#ifdef SIMULATOR
42#define open(a,b) rb->open((a),(b)) 42#define open(a, ...) rb->open((a), __VA_ARGS__)
43#define close(a) rb->close((a)) 43#define close(a) rb->close((a))
44#else 44#else
45int my_open(const char *file, int flags); 45int my_open(const char *file, int flags, ...);
46int my_close(int id); 46int my_close(int id);
47#define open(a,b) my_open((a),(b)) 47#define open(a, ...) my_open((a), __VA_ARGS__)
48#define close(a) my_close((a)) 48#define close(a) my_close((a))
49#endif 49#endif
50 50