mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
@Added tmpfile() function (Stig)
Removed the mkstemp stuff and added tmpfile() function instead.
This commit is contained in:
parent
4ebf7b85ad
commit
5f8f410e51
@ -333,7 +333,6 @@ unsetenv \
|
||||
usleep \
|
||||
utime \
|
||||
vsnprintf \
|
||||
mkstemp \
|
||||
)
|
||||
|
||||
AC_REPLACE_FUNCS(strlcat strlcpy)
|
||||
|
@ -232,6 +232,7 @@ function_entry file_functions[] = {
|
||||
PHP_FE(rename, NULL)
|
||||
PHP_FE(copy, NULL)
|
||||
PHP_FE(tempnam, NULL)
|
||||
PHP_FE(tmpfile, NULL)
|
||||
PHP_FE(file, NULL)
|
||||
PHP_FE(fgetcsv, NULL)
|
||||
PHP_FE(flock, NULL)
|
||||
@ -591,6 +592,23 @@ PHP_FUNCTION(tempnam)
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ proto int tmpfile()
|
||||
Create a temporary file that will be deleted automatically after use. */
|
||||
PHP_FUNCTION(tmpfile)
|
||||
{
|
||||
FILE *fp;
|
||||
if (ARG_COUNT(ht) != 0) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
fp = tmpfile();
|
||||
if (fp == NULL) {
|
||||
php_error(E_WARNING, "tmpfile: %s", strerror(errno));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, fp, le_fopen);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int fopen(string filename, string mode [, int use_include_path])
|
||||
Open a file or a URL and return a file pointer */
|
||||
|
||||
|
@ -40,6 +40,7 @@ extern zend_module_entry file_module_entry;
|
||||
extern PHP_MINIT_FUNCTION(file);
|
||||
|
||||
PHP_FUNCTION(tempnam);
|
||||
PHP_FUNCTION(tmpfile);
|
||||
PHP_FUNCTION(fopen);
|
||||
PHP_FUNCTION(fclose);
|
||||
PHP_FUNCTION(popen);
|
||||
|
@ -168,10 +168,6 @@ typedef zval pval;
|
||||
extern char *strerror(int);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MKSTEMP
|
||||
# define mktemp mkstemp
|
||||
#endif
|
||||
|
||||
#include "fopen-wrappers.h"
|
||||
|
||||
#if APACHE /* apache httpd */
|
||||
|
Loading…
Reference in New Issue
Block a user