diff --git a/f256lib/file.c b/f256lib/file.c index c7557d7..40727f4 100644 --- a/f256lib/file.c +++ b/f256lib/file.c @@ -40,7 +40,7 @@ static char *pathWithoutDrive(char *path, byte *drive); #pragma push_macro("close") #undef close -void fileClose(uint8_t *fd) { +int8_t fileClose(uint8_t *fd) { kernelArgs->file.close.stream = *fd; kernelCall(File.Close); @@ -51,11 +51,13 @@ void fileClose(uint8_t *fd) { switch (kernelEventData.type) { case kernelEvent(file.CLOSED): case kernelEvent(file.ERROR): - return; + return -1; default: continue; } } + + return 0; } #pragma pop_macro("close") diff --git a/f256lib/file.h b/f256lib/file.h index 6abf0db..5514114 100644 --- a/f256lib/file.h +++ b/f256lib/file.h @@ -41,7 +41,7 @@ typedef struct fileDirEntS { } fileDirEntT; -void fileClose(uint8_t *fd); +int8_t fileClose(uint8_t *fd); int8_t fileCloseDir(char *dir); int8_t fileMakeDir(char *dir); uint8_t *fileOpen(char *fname, char *mode); @@ -64,7 +64,6 @@ int16_t fileWrite(void *buf, uint16_t nbytes, uint16_t nmemb, uint8_t *fd); // Aliases to the standard names if they don't exist. #ifndef DIR -#define close fileClose #define closedir fileCloseDir #define DIR char #define dirent fileDirEntS