mirror of https://github.com/ARMmbed/mbed-os.git
fs: Corrected errno when not finding a mounted filesystem
parent
1566395323
commit
400c25466d
|
@ -254,7 +254,7 @@ extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) {
|
||||||
/* The first part of the filename (between first 2 '/') is not a
|
/* The first part of the filename (between first 2 '/') is not a
|
||||||
* registered mount point in the namespace.
|
* registered mount point in the namespace.
|
||||||
*/
|
*/
|
||||||
return handle_open_errors(-ENOENT, fh_i);
|
return handle_open_errors(-ENODEV, fh_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.isFile()) {
|
if (path.isFile()) {
|
||||||
|
@ -262,7 +262,7 @@ extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) {
|
||||||
} else {
|
} else {
|
||||||
FileSystemHandle *fs = path.fileSystem();
|
FileSystemHandle *fs = path.fileSystem();
|
||||||
if (fs == NULL) {
|
if (fs == NULL) {
|
||||||
return handle_open_errors(-ENOENT, fh_i);
|
return handle_open_errors(-ENODEV, fh_i);
|
||||||
}
|
}
|
||||||
int posix_mode = openmode_to_posix(openmode);
|
int posix_mode = openmode_to_posix(openmode);
|
||||||
int err = fs->open(&res, path.fileName(), posix_mode);
|
int err = fs->open(&res, path.fileName(), posix_mode);
|
||||||
|
@ -567,7 +567,7 @@ extern "C" int remove(const char *path) {
|
||||||
FilePath fp(path);
|
FilePath fp(path);
|
||||||
FileSystemHandle *fs = fp.fileSystem();
|
FileSystemHandle *fs = fp.fileSystem();
|
||||||
if (fs == NULL) {
|
if (fs == NULL) {
|
||||||
errno = ENOENT;
|
errno = ENODEV;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,7 +587,7 @@ extern "C" int rename(const char *oldname, const char *newname) {
|
||||||
FileSystemHandle *fsNew = fpNew.fileSystem();
|
FileSystemHandle *fsNew = fpNew.fileSystem();
|
||||||
|
|
||||||
if (fsOld == NULL) {
|
if (fsOld == NULL) {
|
||||||
errno = ENOENT;
|
errno = ENODEV;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ extern "C" DIR *opendir(const char *path) {
|
||||||
FilePath fp(path);
|
FilePath fp(path);
|
||||||
FileSystemHandle* fs = fp.fileSystem();
|
FileSystemHandle* fs = fp.fileSystem();
|
||||||
if (fs == NULL) {
|
if (fs == NULL) {
|
||||||
errno = ENOENT;
|
errno = ENODEV;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,7 +679,10 @@ extern "C" void seekdir(DIR *dir, off_t off) {
|
||||||
extern "C" int mkdir(const char *path, mode_t mode) {
|
extern "C" int mkdir(const char *path, mode_t mode) {
|
||||||
FilePath fp(path);
|
FilePath fp(path);
|
||||||
FileSystemHandle *fs = fp.fileSystem();
|
FileSystemHandle *fs = fp.fileSystem();
|
||||||
if (fs == NULL) return -1;
|
if (fs == NULL) {
|
||||||
|
errno = ENODEV;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int err = fs->mkdir(fp.fileName(), mode);
|
int err = fs->mkdir(fp.fileName(), mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
@ -693,7 +696,10 @@ extern "C" int mkdir(const char *path, mode_t mode) {
|
||||||
extern "C" int stat(const char *path, struct stat *st) {
|
extern "C" int stat(const char *path, struct stat *st) {
|
||||||
FilePath fp(path);
|
FilePath fp(path);
|
||||||
FileSystemHandle *fs = fp.fileSystem();
|
FileSystemHandle *fs = fp.fileSystem();
|
||||||
if (fs == NULL) return -1;
|
if (fs == NULL) {
|
||||||
|
errno = ENODEV;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int err = fs->stat(fp.fileName(), st);
|
int err = fs->stat(fp.fileName(), st);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
|
Loading…
Reference in New Issue