]> granicus.if.org Git - php/commitdiff
- Fix another bug in session.c
authorAndi Gutmans <andi@php.net>
Thu, 30 Mar 2000 22:38:50 +0000 (22:38 +0000)
committerAndi Gutmans <andi@php.net>
Thu, 30 Mar 2000 22:38:50 +0000 (22:38 +0000)
- Start using the new PHP_GETCWD() and co. macros

ext/session/session.c
main/fopen_wrappers.c
main/php.h
main/php_realpath.c
main/safe_mode.c

index ef7201dd9a8f87c7e0028c481cd929ca9046929e..0c268ede5dc3d85651e100eb50283d0c046fb385 100644 (file)
@@ -889,7 +889,7 @@ PHP_FUNCTION(session_get_cookie_params)
                RETURN_FALSE;
        }
 
-       add_assoc_string(return_value, "lifetime", PS(cookie_lifetime), 1);
+       add_assoc_long(return_value, "lifetime", PS(cookie_lifetime));
        add_assoc_string(return_value, "path", PS(cookie_path), 1);
        add_assoc_string(return_value, "domain", PS(cookie_domain), 1);
 }
index f4081ce7f7b859cfab2388988ab43b91ec19ea59..9ab09104e18928b51d129b20653fd02fbc2b0499 100644 (file)
@@ -970,7 +970,7 @@ PHPAPI char *expand_filepath(char *filepath)
        if (filepath[0] == '.') {
                char *cwd = malloc(MAXPATHLEN + 1);
 
-               if (getcwd(cwd, MAXPATHLEN)) {
+               if (PHP_GETCWD(cwd, MAXPATHLEN)) {
                        char *cwd_end = cwd + strlen(cwd);
 
                        if (filepath[1] == '.') {       /* parent directory - .. */
index 4bbb694b5f9a16c1af14047ddf3abd47665a8e15..484d8af81f65e7a2e17b016d0bd898e64fe45078 100644 (file)
@@ -284,6 +284,16 @@ PHPAPI int cfg_get_string(char *varname, char **result);
 #define PUTS_H(str)                                    php_header_write((str), strlen((str)))
 #define PUTC_H(c)                                      (php_header_write(&(c), 1), (c))
 
+/* Virtual current directory support */
+#ifdef VIRTUAL_DIR
+#define PHP_GETCWD(buff, size) virtual_getcwd(buff,size)
+#define PHP_FOPEN(path, mode) virtual_fopen(path, mode)
+#define PHP_CHDIR(path) virtual_chdir(path)
+#else
+#define PHP_GETCWD(buff, size) getcwd(buff,size)
+#define PHP_FOPEN(path, mode)  fopen(path, mode)
+#define PHP_CHDIR(path) chdir(path)
+#endif
 
 #include "zend_constants.h"
 
index 9ced9b4030e67233b37350407e21f3c8cbebbb18..b134b3fce33005a5159ab732bcc88a9c420eb761 100644 (file)
@@ -63,7 +63,7 @@ char *php_realpath(char *path, char resolved_path []) {
        if ((*workpos == '\\') || (*workpos == '/')) {
                /* We start at the root of the current drive */
                /* Get the current directory */
-               if (getcwd(path_construction, MAXPATHLEN-1) == NULL) {
+               if (PHP_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
                        /* Unable to get cwd */
                        resolved_path[0] = 0;
                        return NULL;
@@ -79,7 +79,7 @@ char *php_realpath(char *path, char resolved_path []) {
                workpos++;
        } else {
                /* Use the current directory */
-               if (getcwd(path_construction, MAXPATHLEN-1) == NULL) {
+               if (PHP_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
                        /* Unable to get cwd */
                        resolved_path[0] = 0;
                        return NULL;
@@ -94,7 +94,7 @@ char *php_realpath(char *path, char resolved_path []) {
                workpos++;
        } else {
                /* Use the current directory */
-               if (getcwd(path_construction, MAXPATHLEN-1) == NULL) {
+               if (PHP_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
                        /* Unable to get cwd */
                        resolved_path[0] = 0;
                        return NULL;
index ab026376ba67d5c2af773940bfb0701d16fc94d5..b072552787146da7d3ed729c6fbeee9de37f67fc 100644 (file)
@@ -88,7 +88,7 @@ PHPAPI int php_checkuid(const char *fn, int mode) {
                duid = sb.st_uid;
        } else {
                s = emalloc(MAXPATHLEN+1);
-               if (!getcwd(s,MAXPATHLEN)) {
+               if (!PHP_GETCWD(s,MAXPATHLEN)) {
                        php_error(E_WARNING, "Unable to access current working directory");
                        return(0);
                }