DWORD type;
return GetBinaryType(pathname, &type) ? 0 : -1;
} else {
- size_t pathname_len = strlen(pathname) + 1;
- if(!IS_ABSOLUTE_PATH(pathname, pathname_len)) {
+ if(!IS_ABSOLUTE_PATH(pathname, strlen(pathname)+1)) {
real_path = (char *)malloc(MAX_PATH);
if(tsrm_realpath(pathname, real_path TSRMLS_CC) == NULL) {
goto Finished;
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) {
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)) {