Re: [ZEND-ENGINE-CVS] cvs: TSRM / tsrm_virtual_cwd.c

From: Date: Fri, 10 Nov 2006 17:29:14 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: TSRM / tsrm_virtual_cwd.c
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5398@lists.php.net to get a copy of this message
Dmitry, Can we please change 0, 1, 2 params for virtual_file_ex() into defines so the code becomes a little easier to read? On 10-Nov-06, at 12:24 PM, Dmitry Stogov wrote:
dmitry Fri Nov 10 17:24:11 2006 UTC Modified files:
    /TSRM	tsrm_virtual_cwd.c
Log: Fixed wrong realpath() result in case of unexistent path http://cvs.php.net/viewvc.cgi/TSRM/tsrm_virtual_cwd.c?r1=1.93&r2=1.94&diff_format=u Index: TSRM/tsrm_virtual_cwd.c diff -u TSRM/tsrm_virtual_cwd.c:1.93 TSRM/tsrm_virtual_cwd.c:1.94 --- TSRM/tsrm_virtual_cwd.c:1.93 Fri Nov 10 16:59:34 2006 +++ TSRM/tsrm_virtual_cwd.c Fri Nov 10 17:24:11 2006 @@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: tsrm_virtual_cwd.c,v 1.93 2006/11/10 16:59:34 dmitry Exp $ */ +/* $Id: tsrm_virtual_cwd.c,v 1.94 2006/11/10 17:24:11 dmitry Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -512,7 +512,10 @@ char resolved_path[MAXPATHLEN]; if (!realpath(path, resolved_path)) { /* Note: Not threadsafe on older *BSD's */ - return 1; + if (use_realpath == 2) { + return 1; + } + goto no_realpath; } CWD_STATE_COPY(&old_state, state); @@ -706,7 +709,7 @@ CWD_STATE_COPY(&new_state, &CWDG(cwd)); - if (virtual_file_ex(&new_state, path, NULL, 1)==0) { + if (virtual_file_ex(&new_state, path, NULL, 2)==0) { int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length; memcpy(real_path, new_state.cwd, len); @@ -766,7 +769,7 @@ int ret; CWD_STATE_COPY(&new_state, &CWDG(cwd)); - if (virtual_file_ex(&new_state, pathname, NULL, 1)) { + if (virtual_file_ex(&new_state, pathname, NULL, 2)) { return -1; } @@ -806,7 +809,7 @@ int ret; CWD_STATE_COPY(&new_state, &CWDG(cwd)); - if (virtual_file_ex(&new_state, filename, NULL, 1)) { + if (virtual_file_ex(&new_state, filename, NULL, 2)) { return -1; } @@ -916,7 +919,7 @@ int retval; CWD_STATE_COPY(&new_state, &CWDG(cwd)); - if (virtual_file_ex(&new_state, path, NULL, 1)) { + if (virtual_file_ex(&new_state, path, NULL, 2)) { return -1; } @@ -1005,7 +1008,7 @@ DIR *retval; CWD_STATE_COPY(&new_state, &CWDG(cwd)); - if (virtual_file_ex(&new_state, pathname, NULL, 1)) { + if (virtual_file_ex(&new_state, pathname, NULL, 2)) { return NULL; } @@ -1130,7 +1133,7 @@ new_state.cwd_length = 0; } - if (virtual_file_ex(&new_state, path, NULL, 1)) { + if (virtual_file_ex(&new_state, path, NULL, 2)) { free(new_state.cwd); return NULL; } --Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Ilia Alshanetsky

« previous php.zend-engine.cvs (#5398) next »