Fixed fclose() return value to match(ish) posix.
This commit is contained in:
parent
94a84e3920
commit
7e1aee926e
2 changed files with 5 additions and 4 deletions
|
@ -40,7 +40,7 @@ static char *pathWithoutDrive(char *path, byte *drive);
|
||||||
|
|
||||||
#pragma push_macro("close")
|
#pragma push_macro("close")
|
||||||
#undef close
|
#undef close
|
||||||
void fileClose(uint8_t *fd) {
|
int8_t fileClose(uint8_t *fd) {
|
||||||
kernelArgs->file.close.stream = *fd;
|
kernelArgs->file.close.stream = *fd;
|
||||||
kernelCall(File.Close);
|
kernelCall(File.Close);
|
||||||
|
|
||||||
|
@ -51,11 +51,13 @@ void fileClose(uint8_t *fd) {
|
||||||
switch (kernelEventData.type) {
|
switch (kernelEventData.type) {
|
||||||
case kernelEvent(file.CLOSED):
|
case kernelEvent(file.CLOSED):
|
||||||
case kernelEvent(file.ERROR):
|
case kernelEvent(file.ERROR):
|
||||||
return;
|
return -1;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#pragma pop_macro("close")
|
#pragma pop_macro("close")
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ typedef struct fileDirEntS {
|
||||||
} fileDirEntT;
|
} fileDirEntT;
|
||||||
|
|
||||||
|
|
||||||
void fileClose(uint8_t *fd);
|
int8_t fileClose(uint8_t *fd);
|
||||||
int8_t fileCloseDir(char *dir);
|
int8_t fileCloseDir(char *dir);
|
||||||
int8_t fileMakeDir(char *dir);
|
int8_t fileMakeDir(char *dir);
|
||||||
uint8_t *fileOpen(char *fname, char *mode);
|
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.
|
// Aliases to the standard names if they don't exist.
|
||||||
#ifndef DIR
|
#ifndef DIR
|
||||||
#define close fileClose
|
|
||||||
#define closedir fileCloseDir
|
#define closedir fileCloseDir
|
||||||
#define DIR char
|
#define DIR char
|
||||||
#define dirent fileDirEntS
|
#define dirent fileDirEntS
|
||||||
|
|
Loading…
Add table
Reference in a new issue