cvs: /php4 fopen-wrappers.c php.h php_realpath.c safe_mode.c /php4/ext/session session.c
| From: | Andi Gutmans | Date: | Thu, 30 Mar 2000 22:39:20 +0000 |
| Subject: | cvs: /php4 fopen-wrappers.c php.h php_realpath.c safe_mode.c /php4/ext/session session.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12915@lists.php.net to get a copy of this message | ||
andi Thu Mar 30 14:39:20 2000 EDT
Modified files:
/php4 fopen-wrappers.c php.h php_realpath.c safe_mode.c
/php4/ext/session session.c
Log:
- Fix another bug in session.c
- Start using the new PHP_GETCWD() and co. macros
Index: php4/fopen-wrappers.c
diff -u php4/fopen-wrappers.c:1.46 php4/fopen-wrappers.c:1.47
--- php4/fopen-wrappers.c:1.46 Wed Mar 15 11:12:41 2000
+++ php4/fopen-wrappers.c Thu Mar 30 14:38:49 2000
@@ -16,7 +16,7 @@
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen-wrappers.c,v 1.46 2000/03/15 19:12:41 andi Exp $ */
+/* $Id: fopen-wrappers.c,v 1.47 2000/03/30 22:38:49 andi Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -970,7 +970,7 @@
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: php4/php.h
diff -u php4/php.h:1.72 php4/php.h:1.73
--- php4/php.h:1.72 Sat Mar 25 11:17:41 2000
+++ php4/php.h Thu Mar 30 14:38:49 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php.h,v 1.72 2000/03/25 19:17:41 zeev Exp $ */
+/* $Id: php.h,v 1.73 2000/03/30 22:38:49 andi Exp $ */
#ifndef _PHP_H
#define _PHP_H
@@ -284,6 +284,16 @@
#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: php4/php_realpath.c
diff -u php4/php_realpath.c:1.5 php4/php_realpath.c:1.6
--- php4/php_realpath.c:1.5 Sat Feb 19 15:21:25 2000
+++ php4/php_realpath.c Thu Mar 30 14:38:49 2000
@@ -63,7 +63,7 @@
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 @@
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 @@
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: php4/safe_mode.c
diff -u php4/safe_mode.c:1.16 php4/safe_mode.c:1.17
--- php4/safe_mode.c:1.16 Sat Feb 19 15:21:25 2000
+++ php4/safe_mode.c Thu Mar 30 14:38:49 2000
@@ -15,7 +15,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: safe_mode.c,v 1.16 2000/02/19 23:21:25 zeev Exp $ */
+/* $Id: safe_mode.c,v 1.17 2000/03/30 22:38:49 andi Exp $ */
#include "php.h"
@@ -88,7 +88,7 @@
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);
}
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.125 php4/ext/session/session.c:1.126
--- php4/ext/session/session.c:1.125 Thu Mar 30 14:21:23 2000
+++ php4/ext/session/session.c Thu Mar 30 14:38:50 2000
@@ -889,7 +889,7 @@
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);
}