diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2011-01-11 12:57:19 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2011-01-11 12:57:19 +0000 |
commit | 3abf598b53b1a26c812158d12653f79c4015c263 (patch) | |
tree | 04f7d5433e85952ebf2b24e82d45d08e2566ebaf /main | |
parent | 484a35373e670aa3d234204c918b584230c1cc9a (diff) | |
download | php-git-3abf598b53b1a26c812158d12653f79c4015c263.tar.gz |
Added missing success check around chmod() for windows during temp file creation
Diffstat (limited to 'main')
-rw-r--r-- | main/php_open_temporary_file.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index 91662a05ad..00a0f3f446 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -149,7 +149,11 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char ** if (GetTempFileName(new_state.cwd, pfx, 0, opened_path)) { /* Some versions of windows set the temp file to be read-only, * which means that opening it will fail... */ - VCWD_CHMOD(opened_path, 0600); + if (VCWD_CHMOD(opened_path, 0600)) { + efree(opened_path); + free(new_state.cwd); + return -1; + } fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600); } |