Override libc access in Noux plugin

Fixes #1706
This commit is contained in:
Emery Hemingway 2015-09-20 11:47:17 +02:00 committed by Christian Helmuth
parent 37bae7bc1f
commit 45bcb7f48f
2 changed files with 24 additions and 16 deletions

View File

@ -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,

View File

@ -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[])
{