From 4059ea61d443b25cd18b6f194f0e5969463c460e Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Mon, 11 Nov 2002 16:08:28 +0000 Subject: Bugfix: Flags work better when they're binary... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2830 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/file.c | 16 ++++++---------- firmware/common/file.h | 6 +++--- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'firmware') diff --git a/firmware/common/file.c b/firmware/common/file.c index 82a33ada2d..6d60595ab1 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c @@ -83,17 +83,13 @@ int open(const char* pathname, int flags) errno = EMFILE; return -2; } + memset(&openfiles[fd], 0, sizeof (struct filedesc)); - if (flags & O_RDONLY) { - openfiles[fd].write = false; - } - else { - if (flags & (O_RDWR | O_WRONLY)) { - openfiles[fd].write = true; - - if (flags & O_TRUNC) - openfiles[fd].trunc = true; - } + if (flags & (O_RDWR | O_WRONLY)) { + openfiles[fd].write = true; + + if (flags & O_TRUNC) + openfiles[fd].trunc = true; } openfiles[fd].busy = true; diff --git a/firmware/common/file.h b/firmware/common/file.h index 2effe31ac9..bf7ad82ff7 100644 --- a/firmware/common/file.h +++ b/firmware/common/file.h @@ -37,9 +37,9 @@ #define O_RDONLY 0 #define O_WRONLY 1 #define O_RDWR 2 -#define O_CREAT 3 -#define O_APPEND 4 -#define O_TRUNC 5 +#define O_CREAT 4 +#define O_APPEND 8 +#define O_TRUNC 0x10 #endif #if defined(__MINGW32__) && defined(SIMULATOR) -- cgit v1.2.3