diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2002-10-21 23:35:29 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2002-10-21 23:35:29 +0000 |
commit | d8480c808836dcf973643c058ae13afa11212ab7 (patch) | |
tree | d28b7eba67da1821b4c358c53f35bc6f84497d86 /TSRM | |
parent | 0abca4f60aea1005477aea08883789e312f490cd (diff) | |
download | php-git-d8480c808836dcf973643c058ae13afa11212ab7.tar.gz |
Fixed symlink/link functions on ZTS builds.
Made URL detection in symlink code use php_stream_locate_url_wrapper().
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 28 | ||||
-rw-r--r-- | TSRM/tsrm_virtual_cwd.h | 3 |
2 files changed, 28 insertions, 3 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 31157aaae9..89b580c038 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -282,6 +282,28 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) return buf; } +CWD_API char *virtual_link(char *buf, size_t size TSRMLS_DC) +{ + size_t length; + char *p; + char tmp_path[MAXPATHLEN * 2]; + char resolved_path[MAXPATHLEN]; + + if (IS_ABSOLUTE_PATH(buf, size)) { + memcpy(resolved_path, buf, size); + p[size] = '\0'; + return resolved_path; + } else { + virtual_getcwd(tmp_path, MAXPATHLEN TSRMLS_CC); + p = tmp_path + strlen(tmp_path); + *p++ = '/'; + memcpy(p, buf, size); + *(p + size) = '\0'; + + return tmp_path; + } +} + /* Resolve path relatively to state and put the real path into state */ /* returns 0 for ok, 1 for error */ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path) @@ -703,11 +725,13 @@ CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) { cwd_state new_state; int retval; + char *p; CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL); + /* virtual_file_ex(&new_state, path, NULL); */ + p = virtual_link(path, strlen(path) TSRMLS_CC); - retval = lstat(new_state.cwd, buf); + retval = lstat(p, buf); CWD_STATE_FREE(&new_state); return retval; diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index 5b6fba26a0..025ec0a7a8 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -140,6 +140,7 @@ CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC); #endif #if !defined(TSRM_WIN32) && !defined(NETWARE) CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC); +CWD_API char *virtual_link(char *buf, size_t size TSRMLS_DC); #endif CWD_API int virtual_unlink(const char *path TSRMLS_DC); CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC); @@ -191,7 +192,7 @@ typedef struct _virtual_cwd_globals { #define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC) #define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC) #if !defined(TSRM_WIN32) && !defined(NETWARE) -#define VCWD_LSTAT(path, buff) virtual_stat(path, buff TSRMLS_CC) +#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC) #else #define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC) #endif |