fix: make getcwd report truncated buffers as ERANGE

This commit is contained in:
2026-08-09 12:16:57 +02:00
parent 1c498ffa6a
commit 0b7fd37694
4 changed files with 15 additions and 7 deletions
+3 -2
View File
@@ -2286,8 +2286,9 @@ char *getcwd(char *buf, size_t size) {
errno = EINVAL;
return NULL;
}
if ((int)_zos_syscall2(SYS_GETCWD, (long)buf, (long)size) < 0) {
errno = ERANGE;
int result = (int)_zos_syscall2(SYS_GETCWD, (long)buf, (long)size);
if (result < 0) {
errno = result == -2 ? ERANGE : EIO;
return NULL;
}
return buf;
Binary file not shown.