diff --git a/newlib-files/syscalls.c b/newlib-files/syscalls.c index 4f9a971..cd38a9f 100644 --- a/newlib-files/syscalls.c +++ b/newlib-files/syscalls.c @@ -7,6 +7,8 @@ #include #include +#include + //#include <_ansi.h> #include @@ -93,11 +95,12 @@ isatty(fd) int open(const char *name, int flags, ...) { int nameLen = strlen(name); - unsigned char readOnly = 0; + bool readOnly = false; int fd; - if( flags & O_RDONLY ){ - readOnly = 1; + // O_RDONLY isn't Quite a flag, is defined as 0 + if( flags == O_RDONLY ){ + readOnly = true; } fd = gibOpen(name, nameLen, readOnly); @@ -125,7 +128,7 @@ close(int file) { int read(int file, char *ptr, int len) { // XXX: keyboard support - if(file == 0){ + if(file < 3){ return -1; }