summaryrefslogtreecommitdiff
path: root/Zend/zend_virtual_cwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_virtual_cwd.c')
-rw-r--r--Zend/zend_virtual_cwd.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index dabe6b5fe9..665829d685 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -1442,20 +1442,16 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {
if (VCWD_GETCWD(cwd, MAXPATHLEN)) {
path = cwd;
}
+ } else if (!IS_ABSOLUTE_PATH(path, strlen(path))) {
+ CWD_STATE_COPY(&new_state, &CWDG(cwd));
} else {
- size_t path_len = strlen(path);
-
- if (!IS_ABSOLUTE_PATH(path, path_len)) {
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- } else {
- new_state.cwd = (char*)emalloc(1);
- if (new_state.cwd == NULL) {
- retval = NULL;
- goto end;
- }
- new_state.cwd[0] = '\0';
- new_state.cwd_length = 0;
+ new_state.cwd = (char*)emalloc(1);
+ if (new_state.cwd == NULL) {
+ retval = NULL;
+ goto end;
}
+ new_state.cwd[0] = '\0';
+ new_state.cwd_length = 0;
}
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)==0) {
@@ -1971,21 +1967,17 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
if (VCWD_GETCWD(cwd, MAXPATHLEN)) {
path = cwd;
}
+ } else if (!IS_ABSOLUTE_PATH(path, strlen(path)) &&
+ VCWD_GETCWD(cwd, MAXPATHLEN)) {
+ new_state.cwd = estrdup(cwd);
+ new_state.cwd_length = strlen(cwd);
} else {
- size_t path_len = strlen(path);
-
- if (!IS_ABSOLUTE_PATH(path, path_len) &&
- VCWD_GETCWD(cwd, MAXPATHLEN)) {
- new_state.cwd = estrdup(cwd);
- new_state.cwd_length = strlen(cwd);
- } else {
- new_state.cwd = (char*)emalloc(1);
- if (new_state.cwd == NULL) {
- return NULL;
- }
- new_state.cwd[0] = '\0';
- new_state.cwd_length = 0;
+ new_state.cwd = (char*)emalloc(1);
+ if (new_state.cwd == NULL) {
+ return NULL;
}
+ new_state.cwd[0] = '\0';
+ new_state.cwd_length = 0;
}
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) {