diff options
author | Sascha Schumann <sas@php.net> | 2002-10-04 01:04:00 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2002-10-04 01:04:00 +0000 |
commit | db3f7448a13c702bb4ec63f7fc843f5912b73716 (patch) | |
tree | f3951cec723c974eb8dfcf294ebb546e9d9d3a56 | |
parent | 4f05796a758c66af43d2f38ceee85a6738b6d936 (diff) | |
download | php-git-db3f7448a13c702bb4ec63f7fc843f5912b73716.tar.gz |
Add VCWD_ACCESS
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 18 | ||||
-rw-r--r-- | TSRM/tsrm_virtual_cwd.h | 7 |
2 files changed, 25 insertions, 0 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index a2a65eda74..bcfff1339c 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -540,6 +540,24 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) return f; } +#if !defined(TSRM_WIN32) +CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) +{ + cwd_state new_state; + int ret; + + CWD_STATE_COPY(&new_state, &CWDG(cwd)); + virtual_file_ex(&new_state, pathname, NULL); + + ret = access(new_state.cwd, mode); + + CWD_STATE_FREE(&new_state); + + return ret; +} +#endif + + #if HAVE_UTIME CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) { diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index d77539d1ef..5b6fba26a0 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -146,6 +146,11 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC); CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC); CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC); CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC); + +#if !defined(TSRM_WIN32) +CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC); +#endif + #if HAVE_UTIME CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC); #endif @@ -195,6 +200,7 @@ typedef struct _virtual_cwd_globals { #define VCWD_RMDIR(pathname) virtual_rmdir(pathname TSRMLS_CC) #define VCWD_OPENDIR(pathname) virtual_opendir(pathname TSRMLS_CC) #define VCWD_POPEN(command, type) virtual_popen(command, type TSRMLS_CC) +#define VCWD_ACCESS(pathname, mode) virtual_access(pathname, mode TSRMLS_CC) #if HAVE_UTIME #define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC) #endif @@ -221,6 +227,7 @@ typedef struct _virtual_cwd_globals { #define VCWD_RMDIR(pathname) rmdir(pathname) #define VCWD_OPENDIR(pathname) opendir(pathname) #define VCWD_POPEN(command, type) popen(command, type) +#define VCWD_ACCESS(pathname, mode) access(pathname, mode) #if !defined(TSRM_WIN32) && !defined(NETWARE) #define VCWD_REALPATH(path, real_path) realpath(path, real_path) |