unix, windows: don't include null byte in uv_cwd size
Make it consistent with uv_exepath
This commit is contained in:
parent
68ac0a68e7
commit
8a8cff4b34
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user