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:
parent
4cde667659
commit
4059ea61d4
2 changed files with 9 additions and 13 deletions
|
@ -83,18 +83,14 @@ 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) {
|
|
||||||
openfiles[fd].write = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (flags & (O_RDWR | O_WRONLY)) {
|
if (flags & (O_RDWR | O_WRONLY)) {
|
||||||
openfiles[fd].write = true;
|
openfiles[fd].write = true;
|
||||||
|
|
||||||
if (flags & O_TRUNC)
|
if (flags & O_TRUNC)
|
||||||
openfiles[fd].trunc = true;
|
openfiles[fd].trunc = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
openfiles[fd].busy = true;
|
openfiles[fd].busy = true;
|
||||||
|
|
||||||
/* locate filename */
|
/* locate filename */
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue