summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-05-14 15:12:07 +0000
committerSara Golemon <pollita@php.net>2003-05-14 15:12:07 +0000
commit65d359d71aa87f83f2e2433ea1c562f4372517d2 (patch)
treeef72e6e874962af3a80a9275fee158e6dd51ed16 /main/streams/plain_wrapper.c
parent412f54edaba4adfe8cdcd1b32cbd86dde4c930d6 (diff)
downloadphp-git-65d359d71aa87f83f2e2433ea1c562f4372517d2.tar.gz
Fold 'options' parameter into wops->unlink method
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index d3c36b335f..6b0f13516c 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -889,7 +889,7 @@ static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, ph
return VCWD_STAT(url, &ssb->sb);
}
-static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, php_stream_context *context TSRMLS_DC)
+static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC)
{
char *p;
int ret;
@@ -900,17 +900,21 @@ static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, php_st
url = p + 3;
}
- if (PG(safe_mode) && !php_checkuid(url, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
- return 0;
- }
+ if (options & ENFORCE_SAFE_MODE) {
+ if (PG(safe_mode) && !php_checkuid(url, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
+ return 0;
+ }
- if (php_check_open_basedir(url TSRMLS_CC)) {
- return 0;
+ if (php_check_open_basedir(url TSRMLS_CC)) {
+ return 0;
+ }
}
ret = VCWD_UNLINK(url);
if (ret == -1) {
- php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno));
+ if (options & REPORT_ERRORS) {
+ php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno));
+ }
return 0;
}
/* Clear stat cache */