Filesystem: Added EEXIST reporting to mkdir through errno

pull/3762/head
Christopher Haster 2017-01-20 05:53:40 -06:00 committed by Simon Hughes
parent c8fecb6c88
commit 39a1eddb93
1 changed files with 8 additions and 0 deletions

View File

@ -27,7 +27,12 @@
#include "FATFileSystem.h"
#include "FATFileHandle.h"
#include "FATDirHandle.h"
//<<<<<<< HEAD
#include "mbed_critical.h"
//=======
//#include "critical.h"
#include <errno.h>
//>>>>>>> Filesystem: Added EEXIST reporting to mkdir through errno
DWORD get_fattime(void) {
time_t rawtime;
@ -178,6 +183,9 @@ DirHandle *FATFileSystem::opendir(const char *name) {
int FATFileSystem::mkdir(const char *name, mode_t mode) {
lock();
FRESULT res = f_mkdir(name);
if (res != 0) {
errno = (res == FR_EXIST) ? EEXIST : 0;
}
unlock();
return res == 0 ? 0 : -1;
}