summaryrefslogtreecommitdiff
path: root/main/safe_mode.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/safe_mode.c')
-rw-r--r--main/safe_mode.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main/safe_mode.c b/main/safe_mode.c
index e7bb879362..f545f4d4a8 100644
--- a/main/safe_mode.c
+++ b/main/safe_mode.c
@@ -40,7 +40,7 @@
* 2 - if file does not exist, check directory
* 3 - only check directory (needed for mkdir)
*/
-PHPAPI int php_checkuid(const char *fn, int mode) {
+PHPAPI int php_checkuid(const char *fn, char *fopen_mode, int mode) {
struct stat sb;
int ret;
long uid=0L, duid=0L;
@@ -48,6 +48,14 @@ PHPAPI int php_checkuid(const char *fn, int mode) {
if (!fn) return(0); /* path must be provided */
+ if (fopen_mode) {
+ if (fopen_mode[0] == 'r') {
+ mode = 0;
+ } else {
+ mode = 2;
+ }
+ }
+
/*
* If given filepath is a URL, allow - safe mode stuff
* related to URL's is checked in individual functions