Skip to content

Commit 55ce47f

Browse files
adamgreenadustm
authored andcommitted
Fix issue #1599
My previous commit, c6d2c81, broke Keil builds and maybe even IAR. I need to learn how to read C code :) I thought I was masking off the O_BINARY bit only for GCC builds but it turns out that my update was in the fall-through case for all toolchains. This commit now places the O_BINARY masking operation into a GCC specific #ifdef clause. Testing: I tested the same fopen("/local/out.txt","rb") code as before but this time I built it with the online compiler and GCC_ARM. I tested the resulting binaries on mbed-LPC11U24 and mbed-LPC1768 boards. Thanks to @neilt6 for catching & reporting this!
1 parent 86768e5 commit 55ce47f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/mbed/common/retarget.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ static inline int openmode_to_posix(int openmode) {
121121
if (openmode & _LLIO_CREAT ) posix |= O_CREAT;
122122
if (openmode & _LLIO_APPEND) posix |= O_APPEND;
123123
if (openmode & _LLIO_TRUNC ) posix |= O_TRUNC;
124+
#elif defined(TOOLCHAIN_GCC)
125+
posix &= ~O_BINARY;
124126
#endif
125-
return posix & ~O_BINARY;
127+
return posix;
126128
}
127129

128130
extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) {

0 commit comments

Comments
 (0)