At 03:41 PM 2/13/2003 -0500, James E. Flemer wrote:
Will realpath() work in cases where getcwd() didn't work? (btw it's nicer to check state->cwd_length == 0 than < 1 IMO).RCS file: /repository/TSRM/tsrm_virtual_cwd.c,v retrieving revision 1.41 diff -u -b -r1.41 tsrm_virtual_cwd.c --- TSRM/tsrm_virtual_cwd.c 6 Nov 2002 18:07:22 -0000 1.41 +++ TSRM/tsrm_virtual_cwd.c 13 Feb 2003 20:40:07 -0000 @@ -303,7 +303,7 @@ return (0);#if !defined(TSRM_WIN32) && !defined(NETWARE) - if (IS_ABSOLUTE_PATH(path, path_length)) { + if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) { if (use_realpath && realpath(path, resolved_path)) { path = resolved_path; path_length = strlen(path);
I'm trying to think if there's some other way of doing this. What is the main problem in this loop? Does it add / or c:\ in the beginning of the string?@@ -363,6 +363,7 @@ } + if (state->cwd_length > 0 || IS_ABSOLUTE_PATH(path, path_length)) { ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok); while (ptr) { ptr_length = strlen(ptr); @@ -416,6 +417,11 @@ state->cwd[state->cwd_length+1] = '\0'; state->cwd_length++; } + } else { + state->cwd = (char *) realloc(state->cwd, path_length+1); + memcpy(state->cwd, path, path_length+1); + state->cwd_length = path_length; + }
Andi
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php