Sync with the POSIX signature

This commit is contained in:
Anatol Belski 2017-11-27 14:01:55 +01:00
parent 3ce0de84d7
commit e9927994eb

View file

@ -466,14 +466,14 @@ __forceinline static int php_win32_ioutil_chdir(const char *patha)
return ret; return ret;
}/*}}}*/ }/*}}}*/
__forceinline static char *php_win32_ioutil_getcwd(char *buf, int len) __forceinline static char *php_win32_ioutil_getcwd(char *buf, size_t len)
{/*{{{*/ {/*{{{*/
wchar_t tmp_bufw[PHP_WIN32_IOUTIL_MAXPATHLEN]; wchar_t tmp_bufw[PHP_WIN32_IOUTIL_MAXPATHLEN];
char *tmp_bufa = NULL; char *tmp_bufa = NULL;
size_t tmp_bufa_len; size_t tmp_bufa_len;
DWORD err = 0; DWORD err = 0;
if (php_win32_ioutil_getcwd_w(tmp_bufw, PHP_WIN32_IOUTIL_MAXPATHLEN) == NULL) { if (php_win32_ioutil_getcwd_w(tmp_bufw, len) == NULL) {
err = GetLastError(); err = GetLastError();
SET_ERRNO_FROM_WIN32_CODE(err); SET_ERRNO_FROM_WIN32_CODE(err);
return NULL; return NULL;
@ -494,7 +494,7 @@ __forceinline static char *php_win32_ioutil_getcwd(char *buf, int len)
/* If buf was NULL, the result has to be freed outside here. */ /* If buf was NULL, the result has to be freed outside here. */
buf = tmp_bufa; buf = tmp_bufa;
} else { } else {
if (tmp_bufa_len + 1 > (size_t)len) { if (tmp_bufa_len + 1 > len) {
free(tmp_bufa); free(tmp_bufa);
SET_ERRNO_FROM_WIN32_CODE(ERROR_INSUFFICIENT_BUFFER); SET_ERRNO_FROM_WIN32_CODE(ERROR_INSUFFICIENT_BUFFER);
return NULL; return NULL;