Implement VFS support for access()

Closes https://github.com/espressif/esp-idf/issues/1085
This commit is contained in:
Roland Dobai
2018-05-04 11:44:38 +02:00
parent adc3315677
commit 4345e198ce
5 changed files with 202 additions and 2 deletions
+14
View File
@@ -623,3 +623,17 @@ int fsync(int fd)
CHECK_AND_CALL(ret, r, vfs, fsync, local_fd);
return ret;
}
int access(const char *path, int amode)
{
int ret;
const vfs_entry_t* vfs = get_vfs_for_path(path);
struct _reent* r = __getreent();
if (vfs == NULL) {
__errno_r(r) = ENOENT;
return -1;
}
const char* path_within_vfs = translate_path(vfs, path);
CHECK_AND_CALL(ret, r, vfs, access, path_within_vfs, amode);
return ret;
}