unix, windows: don't include null byte in uv_cwd size

Make it consistent with uv_exepath
This commit is contained in:
Saúl Ibarra Corretgé 2014-10-16 14:18:27 +02:00
parent 68ac0a68e7
commit 8a8cff4b34
2 changed files with 3 additions and 3 deletions

View File

@ -637,7 +637,7 @@ int uv_cwd(char* buffer, size_t* size) {
if (getcwd(buffer, *size) == NULL)
return -errno;
*size = strlen(buffer) + 1;
*size = strlen(buffer);
return 0;
}

View File

@ -206,7 +206,7 @@ int uv_cwd(char* buffer, size_t* size) {
if (r == 0) {
return uv_translate_sys_error(GetLastError());
} else if (r > (int) *size) {
*size = r;
*size = r -1;
return UV_ENOBUFS;
}
@ -223,7 +223,7 @@ int uv_cwd(char* buffer, size_t* size) {
return uv_translate_sys_error(GetLastError());
}
*size = r;
*size = r - 1;
return 0;
}