cvs: TSRM / tsrm_virtual_cwd.c

"Dmitry Stogov" <[email protected]>
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsdmitry1218807102@cvsserver>
dmitry		Fri Aug 15 13:31:42 2008 UTC

  Modified files:              
    /TSRM	tsrm_virtual_cwd.c 
  Log:
  Fixed realpath cache bug
  
  
http://cvs.php.net/viewvc.cgi/TSRM/tsrm_virtual_cwd.c?r1=1.124&r2=1.125&diff_format=u
Index: TSRM/tsrm_virtual_cwd.c
diff -u TSRM/tsrm_virtual_cwd.c:1.124 TSRM/tsrm_virtual_cwd.c:1.125
--- TSRM/tsrm_virtual_cwd.c:1.124	Tue Aug 12 08:01:44 2008
+++ TSRM/tsrm_virtual_cwd.c	Fri Aug 15 13:31:41 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: tsrm_virtual_cwd.c,v 1.124 2008/08/12 08:01:44 dmitry Exp $ */
+/* $Id: tsrm_virtual_cwd.c,v 1.125 2008/08/15 13:31:41 dmitry Exp $ */
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -476,7 +476,7 @@
 
 #define LINK_MAX 32
 
-static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, int use_realpath, int is_dir TSRMLS_DC) /* {{{ */
+static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, int use_realpath, int is_dir, int *link_is_dir TSRMLS_DC) /* {{{ */
 {
 	int i, j, save;
 	int directory = 0;
@@ -511,7 +511,7 @@
 			if (i - 1 <= start) {
 				return start ? start : len;
 			}
-			j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, 1 TSRMLS_CC);
+			j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL TSRMLS_CC);
 			if (j > start) {
 				j--;
 				while (j > start && !IS_SLASH(path[j])) {
@@ -608,7 +608,7 @@
 			}
 			path[j] = 0;
 			if (IS_ABSOLUTE_PATH(path, j)) {
-				j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir TSRMLS_CC);
+				j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC);
 				if (j < 0) {
 					tsrm_free_alloca(tmp, use_heap);
 					return -1;
@@ -621,7 +621,7 @@
 				memmove(path+i, path, j+1);
 				memcpy(path, tmp, i-1);
 				path[i-1] = DEFAULT_SLASH;
-				j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir TSRMLS_CC);
+				j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC);
 				if (j < 0) {
 					tsrm_free_alloca(tmp, use_heap);
 					return -1;
@@ -630,6 +630,9 @@
 		} else {
 			if (save) {
 				directory = S_ISDIR(st.st_mode);
+				if (link_is_dir) {
+					*link_is_dir = directory;
+				}
 				if (is_dir && !directory) {
 					/* not a directory */
 					return -1;
@@ -640,7 +643,7 @@
 				j = start;
 			} else {
 				/* some leading directories may be unaccessable */
-				j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1 TSRMLS_CC);
+				j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1, NULL TSRMLS_CC);
 				if (j > start) {
 					path[j++] = DEFAULT_SLASH;
 				}
@@ -780,7 +783,7 @@
 
 	add_slash = (use_realpath != CWD_REALPATH) && path_length > 0 && IS_SLASH(resolved_path[path_length-1]);	
 	t = CWDG(realpath_cache_ttl) ? 0 : -1;
-	path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0 TSRMLS_CC);
+	path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0, NULL TSRMLS_CC);
 	
 	if (path_length < 0) {
 		return 1;



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.