diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2002-11-04 23:24:15 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2002-11-04 23:24:15 +0000 |
commit | ecb5c7e08edea0a1cc17d4c6477f77819e3b6842 (patch) | |
tree | f3a436ba417f5974843fa9102f78561f8f5e9240 /TSRM | |
parent | 464d8ca5c1650975e7181a42998fcf8e9d8147f3 (diff) | |
download | php-git-ecb5c7e08edea0a1cc17d4c6477f77819e3b6842.tar.gz |
Revert virtual_link() patch.
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 41 | ||||
-rw-r--r-- | TSRM/tsrm_virtual_cwd.h | 3 |
2 files changed, 13 insertions, 31 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 01e1fe9eda..748fb608e4 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -282,29 +282,6 @@ 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) -{ - char *p; - char tmp_path[MAXPATHLEN * 2]; - char resolved_path[MAXPATHLEN]; - - if (IS_ABSOLUTE_PATH(buf, size)) { - p = resolved_path; - memcpy(p, buf, size); - p[size] = '\0'; - } else { - virtual_getcwd(tmp_path, MAXPATHLEN TSRMLS_CC); - p = tmp_path + strlen(tmp_path); - *p++ = '/'; - memcpy(p, buf, size); - *(p + size) = '\0'; - - p = tmp_path; - } - - return p; -} - /* 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) @@ -709,24 +686,30 @@ CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC) #if !defined(TSRM_WIN32) && !defined(NETWARE) CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) { + cwd_state new_state; int retval; - char *p; - p = virtual_link((char *)path, strlen(path) TSRMLS_CC); - retval = lstat(p, buf); + CWD_STATE_COPY(&new_state, &CWDG(cwd)); + virtual_file_ex(&new_state, path, NULL); + + retval = lstat(new_state.cwd, buf); + CWD_STATE_FREE(&new_state); return retval; } #endif CWD_API int virtual_unlink(const char *path TSRMLS_DC) { + cwd_state new_state; int retval; - char *resolved_path; - resolved_path = virtual_link((char *)path, strlen(path) TSRMLS_CC); - retval = unlink(resolved_path); + CWD_STATE_COPY(&new_state, &CWDG(cwd)); + virtual_file_ex(&new_state, path, NULL); + retval = unlink(new_state.cwd); + + CWD_STATE_FREE(&new_state); return retval; } diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index 6d2a51e466..2ecc01c004 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -54,7 +54,7 @@ typedef unsigned short mode_t; (*(c) == '\\' && !IsDBCSLeadByte(*(c-1)))) /* COPY_WHEN_ABSOLUTE also takes path as argument because netware needs it -/* to account for volume name that is unique to NetWare absolute paths + * to account for volume name that is unique to NetWare absolute paths */ #define COPY_WHEN_ABSOLUTE(path) 2 #define IS_ABSOLUTE_PATH(path, len) \ @@ -144,7 +144,6 @@ 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); |