diff options
author | Wez Furlong <wez@php.net> | 2004-09-09 19:41:40 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2004-09-09 19:41:40 +0000 |
commit | ae5598fa85db4940dbb8340ec4fcb7df5c2f2d7b (patch) | |
tree | d37fde2c55ffc6d904ee3cf28dd4a813be7a60d2 | |
parent | 6183a1ed3e1e57a580e38ebe47392cd93de6bc08 (diff) | |
download | php-git-ae5598fa85db4940dbb8340ec4fcb7df5c2f2d7b.tar.gz |
MFH: avoid potential AT&T libc problems with tempnam()
-rw-r--r-- | ext/standard/file.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 6041fa4249..f7b2f6538f 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -695,7 +695,7 @@ PHP_FUNCTION(tempnam) char *d; char *opened_path; char p[64]; - FILE *fp; + int fd; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; @@ -710,8 +710,8 @@ PHP_FUNCTION(tempnam) d = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1)); strlcpy(p, Z_STRVAL_PP(arg2), sizeof(p)); - if ((fp = php_open_temporary_file(d, p, &opened_path TSRMLS_CC))) { - fclose(fp); + if ((fd = php_open_temporary_fd(d, p, &opened_path TSRMLS_CC)) >= 0) { + close(fd); RETVAL_STRING(opened_path, 0); } else { RETVAL_FALSE; |