linux(4): make getcwd(2) return ERANGE instead of ENOMEM

For native FreeBSD binaries, the return value from __getcwd(2)
doesn't really matter, as the libc wrapper takes over and returns
the proper errno.

PR:		kern/254120
Reported By:	Alex S <iwtcex@gmail.com>
Reviewed By:	kib
Sponsored By:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29217
This commit is contained in:
Edward Tomasz Napierala 2021-03-12 15:31:37 +00:00
parent cecfaf9bed
commit 0dfbdd9fc2

View File

@ -74,6 +74,8 @@ linux_getcwd(struct thread *td, struct linux_getcwd_args *uap)
buf = malloc(buflen, M_TEMP, M_WAITOK);
error = vn_getcwd(buf, &retbuf, &buflen);
if (error == ENOMEM)
error = ERANGE;
if (error == 0) {
error = copyout(retbuf, uap->buf, buflen);
if (error == 0)