summaryrefslogtreecommitdiff
path: root/sapi/servlet/servlet.c
diff options
context:
space:
mode:
authorSam Ruby <rubys@php.net>2000-03-30 23:23:29 +0000
committerSam Ruby <rubys@php.net>2000-03-30 23:23:29 +0000
commit8a94c8d598e274cab73453463760f221bf10e680 (patch)
treec70cc0e65c1036e4779597e40c050b0b1f3bb368 /sapi/servlet/servlet.c
parent9c3d6304dd7fe870278a7ad8688e40a9645f609c (diff)
downloadphp-git-8a94c8d598e274cab73453463760f221bf10e680.tar.gz
eliminate chdir if it is already virtual
Diffstat (limited to 'sapi/servlet/servlet.c')
-rw-r--r--sapi/servlet/servlet.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c
index 3546c61914..5cc680f91d 100644
--- a/sapi/servlet/servlet.c
+++ b/sapi/servlet/servlet.c
@@ -365,9 +365,16 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send
* Parse the file
*/
SETSTRING( SG(request_info).path_translated, pathTranslated );
+#ifdef VIRTUAL_DIR
+ file_handle.handle.fp = php_fopen_primary_script();
+#else
+ // The java runtime doesn't like the working directory to be
+ // changed, so save it and change it back as quickly as possible
+ // in the hopes that Java doesn't notice.
getcwd(cwd,MAXPATHLEN);
file_handle.handle.fp = php_fopen_primary_script();
chdir(cwd);
+#endif
file_handle.filename = SG(request_info).path_translated;
file_handle.free_filename = 0;
file_handle.type = ZEND_HANDLE_FP;