Lines Matching refs:path
305 CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat) /* {{{ */ in php_sys_stat_ex() argument
309 const size_t path_len = strlen(path); in php_sys_stat_ex()
312 if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) { in php_sys_stat_ex()
313 return zend_stat(path, buf); in php_sys_stat_ex()
316 if (path_len >= 1 && path[1] == ':') { in php_sys_stat_ex()
317 if (path[0] >= 'A' && path[0] <= 'Z') { in php_sys_stat_ex()
318 buf->st_dev = buf->st_rdev = path[0] - 'A'; in php_sys_stat_ex()
320 buf->st_dev = buf->st_rdev = path[0] - 'a'; in php_sys_stat_ex()
322 } else if (IS_UNC_PATH(path, path_len)) { in php_sys_stat_ex()
333 if (path[0] >= 'A' && path[0] <= 'Z') { in php_sys_stat_ex()
334 buf->st_dev = buf->st_rdev = path[0] - 'A'; in php_sys_stat_ex()
336 buf->st_dev = buf->st_rdev = path[0] - 'a'; in php_sys_stat_ex()
363 …hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_F… in php_sys_stat_ex()
394 size_t len = strlen(path); in php_sys_stat_ex()
396 if (len >= 4 && path[len-4] == '.') { in php_sys_stat_ex()
397 if (_memicmp(path+len-3, "exe", 3) == 0 || in php_sys_stat_ex()
398 _memicmp(path+len-3, "com", 3) == 0 || in php_sys_stat_ex()
399 _memicmp(path+len-3, "bat", 3) == 0 || in php_sys_stat_ex()
400 _memicmp(path+len-3, "cmd", 3) == 0) { in php_sys_stat_ex()
608 static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* {{{ */ in realpath_cache_key() argument
611 char *bucket_key_start = tsrm_win32_get_path_sid_key(path); in realpath_cache_key()
629 static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* {{{ */ in realpath_cache_key() argument
632 const char *e = path + path_len; in realpath_cache_key()
634 for (h = Z_UL(2166136261); path < e;) { in realpath_cache_key()
636 h ^= *path++; in realpath_cache_key()
661 CWD_API void realpath_cache_del(const char *path, int path_len) /* {{{ */ in realpath_cache_del() argument
663 zend_ulong key = realpath_cache_key(path, path_len); in realpath_cache_del()
669 memcmp(path, (*bucket)->path, path_len) == 0) { in realpath_cache_del()
674 if(r->path == r->realpath) { in realpath_cache_del()
689 static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int rea… in realpath_cache_add() argument
695 memcmp(path, realpath, path_len) != 0) { in realpath_cache_add()
708 bucket->key = realpath_cache_key(path, path_len); in realpath_cache_add()
709 bucket->path = (char*)bucket + sizeof(realpath_cache_bucket); in realpath_cache_add()
710 memcpy(bucket->path, path, path_len+1); in realpath_cache_add()
713 bucket->realpath = bucket->path; in realpath_cache_add()
715 bucket->realpath = bucket->path + (path_len + 1); in realpath_cache_add()
735 static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t) … in realpath_cache_find() argument
737 zend_ulong key = realpath_cache_key(path, path_len); in realpath_cache_find()
747 if(r->path == r->realpath) { in realpath_cache_find()
754 memcmp(path, (*bucket)->path, path_len) == 0) { in realpath_cache_find()
764 CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t) /* {… in realpath_cache_lookup() argument
766 return realpath_cache_find(path, path_len, t); in realpath_cache_lookup()
789 static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, int use_realpath, in… in tsrm_realpath_r() argument
813 while (i > start && !IS_SLASH(path[i-1])) { in tsrm_realpath_r()
818 (i == len - 1 && path[i] == '.')) { in tsrm_realpath_r()
823 } else if (i == len - 2 && path[i] == '.' && path[i+1] == '.') { in tsrm_realpath_r()
832 j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL); in tsrm_realpath_r()
835 while (j > start && !IS_SLASH(path[j])) { in tsrm_realpath_r()
840 if (j == 0 && path[0] == '.' && path[1] == '.' && in tsrm_realpath_r()
841 IS_SLASH(path[2])) { in tsrm_realpath_r()
842 path[3] = '.'; in tsrm_realpath_r()
843 path[4] = '.'; in tsrm_realpath_r()
844 path[5] = DEFAULT_SLASH; in tsrm_realpath_r()
847 path[j+1] == '.' && path[j+2] == '.' && in tsrm_realpath_r()
848 IS_SLASH(path[j+3])) { in tsrm_realpath_r()
850 path[j++] = '.'; in tsrm_realpath_r()
851 path[j++] = '.'; in tsrm_realpath_r()
852 path[j] = DEFAULT_SLASH; in tsrm_realpath_r()
857 path[0] = '.'; in tsrm_realpath_r()
858 path[1] = '.'; in tsrm_realpath_r()
859 path[2] = DEFAULT_SLASH; in tsrm_realpath_r()
865 path[len] = 0; in tsrm_realpath_r()
874 if ((bucket = realpath_cache_find(path, len, *t)) != NULL) { in tsrm_realpath_r()
882 memcpy(path, bucket->realpath, bucket->realpath_len + 1); in tsrm_realpath_r()
889 if (save && (hFind = FindFirstFile(path, &data)) == INVALID_HANDLE_VALUE) { in tsrm_realpath_r()
903 memcpy(tmp, path, len+1); in tsrm_realpath_r()
906 !(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') && in tsrm_realpath_r()
924 …hLink = CreateFile(path, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_… in tsrm_realpath_r()
999 memcpy(substitutename, path, len + 1); in tsrm_realpath_r()
1032 *(path + bufindex) = *(tmp2 + bufindex); in tsrm_realpath_r()
1035 *(path + bufindex) = 0; in tsrm_realpath_r()
1045 fprintf(stderr, "resolved: %s ", path); in tsrm_realpath_r()
1050 if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) { in tsrm_realpath_r()
1052 j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, &directory); in tsrm_realpath_r()
1065 memmove(path+i, path, j+1); in tsrm_realpath_r()
1066 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1067 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1068 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory); in tsrm_realpath_r()
1092 memcpy(tmp, path, len+1); in tsrm_realpath_r()
1094 if (save && php_sys_lstat(path, &st) < 0) { in tsrm_realpath_r()
1104 memcpy(tmp, path, len+1); in tsrm_realpath_r()
1107 if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) { in tsrm_realpath_r()
1112 path[j] = 0; in tsrm_realpath_r()
1113 if (IS_ABSOLUTE_PATH(path, j)) { in tsrm_realpath_r()
1114 j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory); in tsrm_realpath_r()
1124 memmove(path+i, path, j+1); in tsrm_realpath_r()
1125 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1126 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1127 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory); in tsrm_realpath_r()
1153 j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1, NULL); in tsrm_realpath_r()
1155 path[j++] = DEFAULT_SLASH; in tsrm_realpath_r()
1165 memcpy(path+j, data.cFileName, i+1); in tsrm_realpath_r()
1169 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1178 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1185 realpath_cache_add(tmp, len, path, j, directory, *t); in tsrm_realpath_r()
1196 CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int u… in virtual_file_ex() argument
1198 int path_length = (int)strlen(path); in virtual_file_ex()
1217 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1223 if (!IS_ABSOLUTE_PATH(path, path_length)) { in virtual_file_ex()
1227 memcpy(resolved_path , path, path_length + 1); in virtual_file_ex()
1232 if (IS_SLASH(path[0])) { in virtual_file_ex()
1261 memcpy(resolved_path + state_cwd_length, path, path_length + 1); in virtual_file_ex()
1265 memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1); in virtual_file_ex()
1271 if (path_length > 2 && path[1] == ':' && !IS_SLASH(path[2])) { in virtual_file_ex()
1272 resolved_path[0] = path[0]; in virtual_file_ex()
1275 memcpy(resolved_path + 3, path + 2, path_length - 1); in virtual_file_ex()
1279 memcpy(resolved_path, path, path_length + 1); in virtual_file_ex()
1400 CWD_API int virtual_chdir(const char *path) /* {{{ */ in virtual_chdir() argument
1402 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0; in virtual_chdir()
1406 CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path)) /* {{{ */ in virtual_chdir_file() argument
1408 int length = (int)strlen(path); in virtual_chdir_file()
1416 while(--length >= 0 && !IS_SLASH(path[length])) { in virtual_chdir_file()
1425 …if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing… in virtual_chdir_file()
1429 memcpy(temp, path, length); in virtual_chdir_file()
1440 CWD_API char *virtual_realpath(const char *path, char *real_path) /* {{{ */ in virtual_realpath() argument
1447 if (!*path) { in virtual_realpath()
1456 path = cwd; in virtual_realpath()
1458 } else if (!IS_ABSOLUTE_PATH(path, strlen(path))) { in virtual_realpath()
1470 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)==0) { in virtual_realpath()
1486 CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path) /*… in virtual_filepath_ex() argument
1492 retval = virtual_file_ex(&new_state, path, verify_path, CWD_FILEPATH); in virtual_filepath_ex()
1501 CWD_API int virtual_filepath(const char *path, char **filepath) /* {{{ */ in virtual_filepath() argument
1503 return virtual_filepath_ex(path, filepath, php_is_file_ok); in virtual_filepath()
1507 CWD_API FILE *virtual_fopen(const char *path, const char *mode) /* {{{ */ in virtual_fopen() argument
1512 if (path[0] == '\0') { /* Fail to open empty path */ in virtual_fopen()
1517 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) { in virtual_fopen()
1637 CWD_API int virtual_open(const char *path, int flags, ...) /* {{{ */ in virtual_open() argument
1643 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) { in virtual_open()
1665 CWD_API int virtual_creat(const char *path, mode_t mode) /* {{{ */ in virtual_creat() argument
1671 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) { in virtual_creat()
1720 CWD_API int virtual_stat(const char *path, zend_stat_t *buf) /* {{{ */ in virtual_stat() argument
1726 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) { in virtual_stat()
1738 CWD_API int virtual_lstat(const char *path, zend_stat_t *buf) /* {{{ */ in virtual_lstat() argument
1744 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) { in virtual_lstat()
1756 CWD_API int virtual_unlink(const char *path) /* {{{ */ in virtual_unlink() argument
1762 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) { in virtual_unlink()
1932 CWD_API char *tsrm_realpath(const char *path, char *real_path) /* {{{ */ in tsrm_realpath() argument
1938 if (!*path) { in tsrm_realpath()
1946 path = cwd; in tsrm_realpath()
1948 } else if (!IS_ABSOLUTE_PATH(path, strlen(path)) && in tsrm_realpath()
1961 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) { in tsrm_realpath()