diff --git a/repos/libports/src/lib/libc/vfs_plugin.cc b/repos/libports/src/lib/libc/vfs_plugin.cc index a1f0f184b0..d55359c8fd 100644 --- a/repos/libports/src/lib/libc/vfs_plugin.cc +++ b/repos/libports/src/lib/libc/vfs_plugin.cc @@ -253,8 +253,14 @@ class Libc::Vfs_plugin : public Libc::Plugin }; -int Libc::Vfs_plugin::access(const char *path, int amode) { - return _root_dir.leaf_path(path) ? 0 : -1; } +int Libc::Vfs_plugin::access(const char *path, int amode) +{ + if (_root_dir.leaf_path(path)) + return 0; + + errno = ENOENT; + return -1; +} Libc::File_descriptor *Libc::Vfs_plugin::open(char const *path, int flags, diff --git a/repos/ports/src/lib/libc_noux/plugin.cc b/repos/ports/src/lib/libc_noux/plugin.cc index bc0510910c..0913df2a64 100644 --- a/repos/ports/src/lib/libc_noux/plugin.cc +++ b/repos/ports/src/lib/libc_noux/plugin.cc @@ -567,20 +567,6 @@ extern "C" pid_t getpid(void) extern "C" pid_t getppid(void) { return getpid(); } -extern "C" int access(char const *pathname, int mode) -{ - if (verbose) - PDBG("access '%s' (mode=%x) called, not implemented", pathname, mode); - - struct stat stat; - if (::stat(pathname, &stat) == 0) - return 0; - - errno = ENOENT; - return -1; -} - - extern "C" int chmod(char const *path, mode_t mode) { if (verbose) @@ -889,6 +875,7 @@ namespace { } } + bool supports_access(const char *, int) { return true; } bool supports_execve(char const *, char *const[], char *const[]) { return true; } bool supports_open(char const *, int) { return true; } @@ -903,6 +890,7 @@ namespace { bool supports_socket(int, int, int) { return true; } bool supports_mmap() { return true; } + int access(char const *, int); Libc::File_descriptor *open(char const *, int); ssize_t write(Libc::File_descriptor *, const void *, ::size_t); int close(Libc::File_descriptor *); @@ -957,6 +945,20 @@ namespace { }; + int Plugin::access(char const *pathname, int mode) + { + if (verbose) + PDBG("access '%s' (mode=%x) called, not implemented", pathname, mode); + + struct stat stat; + if (::stat(pathname, &stat) == 0) + return 0; + + errno = ENOENT; + return -1; + } + + int Plugin::execve(char const *filename, char *const argv[], char *const envp[]) {