| Dmitry Stogov 2006-11-13, 6:56 pm |
| dmitry Mon Nov 13 15:13:20 2006 UTC
Modified files: (Branch: PHP_5_2)
/TSRM tsrm_virtual_cwd.c tsrm_virtual_cwd.h
Log:
Use symbolic names
http://cvs.php.net/viewvc.cgi/TSRM/...4&diff_format=u
Index: TSRM/tsrm_virtual_cwd.c
diff -u TSRM/tsrm_virtual_cwd.c:1.74.2.9.2.13 TSRM/tsrm_virtual_cwd.c:1.74.2.9.2.14
--- TSRM/tsrm_virtual_cwd.c:1.74.2.9.2.13 Fri Nov 10 17:23:58 2006
+++ TSRM/tsrm_virtual_cwd.c Mon Nov 13 15:13:20 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tsrm_virtual_cwd.c,v 1.74.2.9.2.13 2006/11/10 17:23:58 dmitry Exp $ */
+/* $Id: tsrm_virtual_cwd.c,v 1.74.2.9.2.14 2006/11/13 15:13:20 dmitry Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
@@ -512,7 +512,7 @@
char resolved_path[MAXPATHLEN];
if (!realpath(path, resolved_path)) { /* Note: Not threadsafe on older *BSD's */
- if (use_realpath == 2) {
+ if (use_realpath == CWD_REALPATH) {
return 1;
}
goto no_realpath;
@@ -667,7 +667,7 @@
CWD_API int virtual_chdir(const char *path TSRMLS_DC)
{
- return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, 1)?-1:0;
+ return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0;
}
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC)
@@ -709,7 +709,7 @@
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, path, NULL, 2)==0) {
+ if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)==0) {
int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
memcpy(real_path, new_state.cwd, len);
@@ -730,7 +730,7 @@
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- retval = virtual_file_ex(&new_state, path, verify_path, 1);
+ retval = virtual_file_ex(&new_state, path, verify_path, CWD_FILEPATH);
*filepath = new_state.cwd;
@@ -753,7 +753,7 @@
}
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, path, NULL, 1)) {
+ if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) {
return NULL;
}
@@ -769,7 +769,7 @@
int ret;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, pathname, NULL, 2)) {
+ if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH)) {
return -1;
}
@@ -792,7 +792,7 @@
int ret;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, filename, NULL, 0)) {
+ if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH)) {
return -1;
}
@@ -809,7 +809,7 @@
int ret;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, filename, NULL, 2)) {
+ if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH)) {
return -1;
}
@@ -826,7 +826,7 @@
int ret;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, filename, NULL, 0)) {
+ if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH)) {
return -1;
}
@@ -851,7 +851,7 @@
int f;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, path, NULL, 1)) {
+ if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) {
return -1;
}
@@ -877,7 +877,7 @@
int f;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, path, NULL, 1)) {
+ if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) {
return -1;
}
@@ -894,13 +894,13 @@
int retval;
CWD_STATE_COPY(&old_state, &CWDG(cwd));
- if (virtual_file_ex(&old_state, oldname, NULL, 0)) {
+ if (virtual_file_ex(&old_state, oldname, NULL, CWD_REALPATH)) {
return -1;
}
oldname = old_state.cwd;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, newname, NULL, 0)) {
+ if (virtual_file_ex(&new_state, newname, NULL, CWD_FILEPATH)) {
return -1;
}
newname = new_state.cwd;
@@ -919,7 +919,7 @@
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, path, NULL, 2)) {
+ if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) {
return -1;
}
@@ -936,7 +936,7 @@
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, path, NULL, 0)) {
+ if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) {
return -1;
}
@@ -953,7 +953,7 @@
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, path, NULL, 0)) {
+ if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) {
return -1;
}
@@ -969,7 +969,7 @@
int 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, CWD_FILEPATH)) {
return -1;
}
@@ -988,7 +988,7 @@
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, pathname, NULL, 0)) {
+ if (virtual_file_ex(&new_state, pathname, NULL, CWD_EXPAND)) {
return -1;
}
@@ -1008,7 +1008,7 @@
DIR *retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- if (virtual_file_ex(&new_state, pathname, NULL, 2)) {
+ if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH)) {
return NULL;
}
@@ -1133,7 +1133,7 @@
new_state.cwd_length = 0;
}
- if (virtual_file_ex(&new_state, path, NULL, 2)) {
+ if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) {
free(new_state.cwd);
return NULL;
}
http://cvs.php.net/viewvc.cgi/TSRM/...5&diff_format=u
Index: TSRM/tsrm_virtual_cwd.h
diff -u TSRM/tsrm_virtual_cwd.h:1.48.2.5.2.4 TSRM/tsrm_virtual_cwd.h:1.48.2.5.2.5
--- TSRM/tsrm_virtual_cwd.h:1.48.2.5.2.4 Fri Nov 10 15:04:07 2006
+++ TSRM/tsrm_virtual_cwd.h Mon Nov 13 15:13:20 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tsrm_virtual_cwd.h,v 1.48.2.5.2.4 2006/11/10 15:04:07 dmitry Exp $ */
+/* $Id: tsrm_virtual_cwd.h,v 1.48.2.5.2.5 2006/11/13 15:13:20 dmitry Exp $ */
#ifndef VIRTUAL_CWD_H
#define VIRTUAL_CWD_H
@@ -186,6 +186,10 @@
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC);
#endif
+#define CWD_EXPAND 0
+#define CWD_FILEPATH 1
+#define CWD_REALPATH 2
+
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath);
CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC);
|