iliaa                                    Tue, 11 Jan 2011 12:57:19 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=307375

Log:
Added missing success check around chmod() for windows during temp file creation

Changed paths:
    U   php/php-src/branches/PHP_5_3/main/php_open_temporary_file.c
    U   php/php-src/trunk/main/php_open_temporary_file.c

Modified: php/php-src/branches/PHP_5_3/main/php_open_temporary_file.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/php_open_temporary_file.c 2011-01-11 
12:36:27 UTC (rev 307374)
+++ php/php-src/branches/PHP_5_3/main/php_open_temporary_file.c 2011-01-11 
12:57:19 UTC (rev 307375)
@@ -149,7 +149,11 @@
        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);
        }


Modified: php/php-src/trunk/main/php_open_temporary_file.c
===================================================================
--- php/php-src/trunk/main/php_open_temporary_file.c    2011-01-11 12:36:27 UTC 
(rev 307374)
+++ php/php-src/trunk/main/php_open_temporary_file.c    2011-01-11 12:57:19 UTC 
(rev 307375)
@@ -149,7 +149,11 @@
        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);
        }


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to