1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

- Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent, windows fix

This commit is contained in:
Pierre Joye
2011-03-28 16:43:49 +00:00
parent 0625b3882d
commit 264d2b3480

View File

@@ -204,9 +204,13 @@ PHPAPI const char* php_get_temporary_directory(void)
*/
{
char sTemp[MAX_PATH];
DWORD n = GetTempPath(sizeof(sTemp),sTemp);
assert(0 < n); /* should *never* fail! */
temporary_directory = strdup(sTemp);
DWORD len = GetTempPath(sizeof(sTemp),sTemp);
assert(0 < len); /* should *never* fail! */
if (sTemp[len - 1] == DEFAULT_SLASH) {
temporary_directory = zend_strndup(sTemp, len - 1);
} else {
temporary_directory = zend_strndup(sTemp, len);
}
return temporary_directory;
}
#else