From: Anatol Belski Date: Wed, 11 Jul 2018 11:16:04 +0000 (+0200) Subject: Merge branch 'PHP-7.2' X-Git-Tag: php-7.3.0alpha4~42 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=871d0aa5cd01aba5f31f28b641e2b013ac46ec58;p=php Merge branch 'PHP-7.2' * PHP-7.2: Fix condition --- 871d0aa5cd01aba5f31f28b641e2b013ac46ec58 diff --cc win32/ioutil.c index 9e54e96342,9a13c1cd6e..2ff62e3b6c --- a/win32/ioutil.c +++ b/win32/ioutil.c @@@ -283,20 -285,33 +283,20 @@@ PW32IO int php_win32_ioutil_close(int f return result; }/*}}}*/ -#if 0 PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode) {/*{{{*/ - int ret = 0; - DWORD err = 0; + size_t path_len; + const wchar_t *my_path; - PHP_WIN32_IOUTIL_CHECK_PATH_W(path, -1, 0) - - /* TODO extend with mode usage */ - if (!CreateDirectoryW(path, NULL)) { - err = GetLastError(); - ret = -1; - SET_ERRNO_FROM_WIN32_CODE(err); + if (!path) { + SET_ERRNO_FROM_WIN32_CODE(ERROR_INVALID_PARAMETER); + return -1; } - return ret; -}/*}}}*/ -#endif - -PW32IO int php_win32_ioutil_mkdir(const char *path, mode_t mode) -{/*{{{*/ - size_t pathw_len = 0; - wchar_t *pathw = php_win32_ioutil_conv_any_to_w(path, 0, &pathw_len); - int ret = 0; - DWORD err = 0; + PHP_WIN32_IOUTIL_CHECK_PATH_W(path, -1, 0) - if (pathw_len < _MAX_PATH && pathw_len >= _MAX_PATH - 12) { + path_len = wcslen(path); - if (path_len < _MAX_PATH && path_len > _MAX_PATH - 12) { ++ if (path_len < _MAX_PATH && path_len >= _MAX_PATH - 12) { /* Special case here. From the doc: "When using an API to create a directory, the specified path cannot be