summaryrefslogtreecommitdiff
path: root/main/php_open_temporary_file.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2003-04-11 11:08:44 +0000
committerWez Furlong <wez@php.net>2003-04-11 11:08:44 +0000
commit2090d23f0264952cbdfe6f7d0f2504204372494d (patch)
treeb87c861a37dc6211fa5d6096e52893af4d7f5810 /main/php_open_temporary_file.c
parenta802e0d6b3cfe6ff2a1c38a19d0b973d097fbc37 (diff)
downloadphp-git-2090d23f0264952cbdfe6f7d0f2504204372494d.tar.gz
Fix for #23069 (Windows sets readonly mode for temporary files in tempnam)
Diffstat (limited to 'main/php_open_temporary_file.c')
-rw-r--r--main/php_open_temporary_file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
index ac1f8c9dd8..27277358b2 100644
--- a/main/php_open_temporary_file.c
+++ b/main/php_open_temporary_file.c
@@ -132,7 +132,10 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char **
#ifdef PHP_WIN32
if (GetTempFileName(path, pfx, 0, opened_path)) {
- fd = VCWD_OPEN(opened_path, open_flags);
+ /* Some versions of windows set the temp file to be read-only,
+ * which means that opening it will fail... */
+ VCWD_CHMOD(opened_path, 0600);
+ fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600);
}
#elif defined(NETWARE)
/* Using standard mktemp() implementation for NetWare */