- Baby steps... Use PHP_FOPEN()

This commit is contained in:
Andi Gutmans 2000-03-30 22:41:13 +00:00
parent 72b57c66f0
commit 9df7df3293
3 changed files with 10 additions and 10 deletions

View File

@ -204,7 +204,7 @@ PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock,
return NULL;
}
if (php_check_open_basedir(path)) return NULL;
return fopen(path, mode);
return PHP_FOPEN(path, mode);
}
}
@ -282,7 +282,7 @@ PHPAPI FILE *php_fopen_primary_script(void)
SG(request_info).path_translated = NULL;
return NULL;
}
fp = fopen(fn, "r");
fp = PHP_FOPEN(fn, "r");
/* refuse to open anything that is not a regular file */
if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) {
@ -331,7 +331,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
return NULL;
}
if (php_check_open_basedir(filename)) return NULL;
fp = fopen(filename, mode);
fp = PHP_FOPEN(filename, mode);
if (fp && opened_path) {
*opened_path = expand_filepath(filename);
}
@ -353,14 +353,14 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
return NULL;
}
if (php_check_open_basedir(trypath)) return NULL;
fp = fopen(trypath, mode);
fp = PHP_FOPEN(trypath, mode);
if (fp && opened_path) {
*opened_path = expand_filepath(trypath);
}
return fp;
} else {
if (php_check_open_basedir(filename)) return NULL;
return fopen(filename, mode);
return PHP_FOPEN(filename, mode);
}
}
if (!path || (path && !*path)) {
@ -368,7 +368,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
return NULL;
}
if (php_check_open_basedir(filename)) return NULL;
fp = fopen(filename, mode);
fp = PHP_FOPEN(filename, mode);
if (fp && opened_path) {
*opened_path = strdup(filename);
}
@ -395,7 +395,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
return NULL;
}
}
if ((fp = fopen(trypath, mode)) != NULL) {
if ((fp = PHP_FOPEN(trypath, mode)) != NULL) {
if (php_check_open_basedir(trypath)) {
fclose(fp);
efree(pathbuf);
@ -898,7 +898,7 @@ static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, in
if (php_check_open_basedir((char *) path)) {
fp = NULL;
} else {
fp = fopen(path, mode);
fp = PHP_FOPEN(path, mode);
}
}
}

View File

@ -250,7 +250,7 @@ void php_log_err(char *log_message)
return;
}
#endif
log_file = fopen(PG(error_log), "a");
log_file = PHP_FOPEN(PG(error_log), "a");
if (log_file != NULL) {
time(&error_time);
strftime(error_time_str, 128, "%d-%b-%Y %H:%M:%S", localtime_r(&error_time, &tmbuf));

View File

@ -254,7 +254,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr)
} else if ((loc - ptr - 4) <= 0) {
fn = "none";
} else {
fp = fopen(fn, "wb");
fp = PHP_FOPEN(fn, "wb");
if (!fp) {
php_error(E_WARNING, "File Upload Error - Unable to open temporary file [%s]", fn);
SAFE_RETURN;