ssb Mon Apr 16 16:20:47 2001 EDT
Modified files:
/php4/main SAPI.h fopen_wrappers.c
/php4/sapi/cgi cgi_main.c
Log:
@Added -C command-line option to avoid chdir to the script's directory (Stig)
Index: php4/main/SAPI.h
diff -u php4/main/SAPI.h:1.68 php4/main/SAPI.h:1.69
--- php4/main/SAPI.h:1.68 Sat Mar 17 18:32:04 2001
+++ php4/main/SAPI.h Mon Apr 16 16:20:47 2001
@@ -25,6 +25,8 @@
#include "zend_operators.h"
#include <sys/stat.h>
+#define SAPI_OPTION_NO_CHDIR 1
+
#define SAPI_POST_BLOCK_SIZE 4000
#ifdef PHP_WIN32
@@ -109,6 +111,7 @@
char *default_charset;
HashTable *rfc1867_uploaded_files;
long post_max_size;
+ int options;
} sapi_globals_struct;
Index: php4/main/fopen_wrappers.c
diff -u php4/main/fopen_wrappers.c:1.111 php4/main/fopen_wrappers.c:1.112
--- php4/main/fopen_wrappers.c:1.111 Sun Feb 25 22:07:31 2001
+++ php4/main/fopen_wrappers.c Mon Apr 16 16:20:47 2001
@@ -16,7 +16,7 @@
| Jim Winstead <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c,v 1.111 2001/02/26 06:07:31 andi Exp $ */
+/* $Id: fopen_wrappers.c,v 1.112 2001/04/16 23:20:47 ssb Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -348,7 +348,9 @@
STR_FREE(SG(request_info).path_translated); /* for same reason as
above */
return NULL;
}
- V_CHDIR_FILE(filename);
+ if (!(SG(options) & SAPI_OPTION_NO_CHDIR)) {
+ V_CHDIR_FILE(filename);
+ }
SG(request_info).path_translated = filename;
return fp;
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.100 php4/sapi/cgi/cgi_main.c:1.101
--- php4/sapi/cgi/cgi_main.c:1.100 Thu Mar 22 10:54:51 2001
+++ php4/sapi/cgi/cgi_main.c Mon Apr 16 16:20:47 2001
@@ -80,7 +80,7 @@
extern char *ap_php_optarg;
extern int ap_php_optind;
-#define OPTSTRING "ac:d:ef:g:hilmnqs?vz:"
+#define OPTSTRING "aCc:d:ef:g:hilmnqs?vz:"
static int _print_module_info ( zend_module_entry *module, void *arg ) {
php_printf("%s\n", module->name);
@@ -246,6 +246,7 @@
" -s Display colour syntax highlighted
source.\n"
" -f <file> Parse <file>. Implies `-q'\n"
" -v Version number\n"
+ " -C Do not chdir to the script's directory\n"
" -c <path> Look for php.ini file in this
directory\n"
#if SUPPORT_INTERACTIVE
" -a Run interactively\n"
@@ -525,7 +526,10 @@
#endif
break;
- case 'd': /* define ini entries on command line */
+ case 'C': /* don't chdir to the script directory */
+ SG(options) |= SAPI_OPTION_NO_CHDIR;
+ break;
+ case 'd': /* define ini entries on command line */
define_command_line_ini_entry(ap_php_optarg);
break;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]