mirror of https://github.com/ARMmbed/mbed-os.git
Filesystem: Added EEXIST reporting to mkdir through errno
parent
c8fecb6c88
commit
39a1eddb93
|
@ -27,7 +27,12 @@
|
||||||
#include "FATFileSystem.h"
|
#include "FATFileSystem.h"
|
||||||
#include "FATFileHandle.h"
|
#include "FATFileHandle.h"
|
||||||
#include "FATDirHandle.h"
|
#include "FATDirHandle.h"
|
||||||
|
//<<<<<<< HEAD
|
||||||
#include "mbed_critical.h"
|
#include "mbed_critical.h"
|
||||||
|
//=======
|
||||||
|
//#include "critical.h"
|
||||||
|
#include <errno.h>
|
||||||
|
//>>>>>>> Filesystem: Added EEXIST reporting to mkdir through errno
|
||||||
|
|
||||||
DWORD get_fattime(void) {
|
DWORD get_fattime(void) {
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
|
@ -178,6 +183,9 @@ DirHandle *FATFileSystem::opendir(const char *name) {
|
||||||
int FATFileSystem::mkdir(const char *name, mode_t mode) {
|
int FATFileSystem::mkdir(const char *name, mode_t mode) {
|
||||||
lock();
|
lock();
|
||||||
FRESULT res = f_mkdir(name);
|
FRESULT res = f_mkdir(name);
|
||||||
|
if (res != 0) {
|
||||||
|
errno = (res == FR_EXIST) ? EEXIST : 0;
|
||||||
|
}
|
||||||
unlock();
|
unlock();
|
||||||
return res == 0 ? 0 : -1;
|
return res == 0 ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue