1
0
Fork 0
forked from len0rd/rockbox

Bugfix: Flags work better when they're binary...

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2830 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-11-11 16:08:28 +00:00
parent 4cde667659
commit 4059ea61d4
2 changed files with 9 additions and 13 deletions

View file

@ -83,17 +83,13 @@ int open(const char* pathname, int flags)
errno = EMFILE; errno = EMFILE;
return -2; return -2;
} }
memset(&openfiles[fd], 0, sizeof (struct filedesc));
if (flags & O_RDONLY) { if (flags & (O_RDWR | O_WRONLY)) {
openfiles[fd].write = false; openfiles[fd].write = true;
}
else { if (flags & O_TRUNC)
if (flags & (O_RDWR | O_WRONLY)) { openfiles[fd].trunc = true;
openfiles[fd].write = true;
if (flags & O_TRUNC)
openfiles[fd].trunc = true;
}
} }
openfiles[fd].busy = true; openfiles[fd].busy = true;

View file

@ -37,9 +37,9 @@
#define O_RDONLY 0 #define O_RDONLY 0
#define O_WRONLY 1 #define O_WRONLY 1
#define O_RDWR 2 #define O_RDWR 2
#define O_CREAT 3 #define O_CREAT 4
#define O_APPEND 4 #define O_APPEND 8
#define O_TRUNC 5 #define O_TRUNC 0x10
#endif #endif
#if defined(__MINGW32__) && defined(SIMULATOR) #if defined(__MINGW32__) && defined(SIMULATOR)