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:
parent
cecfaf9bed
commit
0dfbdd9fc2
@ -74,6 +74,8 @@ linux_getcwd(struct thread *td, struct linux_getcwd_args *uap)
|
|||||||
|
|
||||||
buf = malloc(buflen, M_TEMP, M_WAITOK);
|
buf = malloc(buflen, M_TEMP, M_WAITOK);
|
||||||
error = vn_getcwd(buf, &retbuf, &buflen);
|
error = vn_getcwd(buf, &retbuf, &buflen);
|
||||||
|
if (error == ENOMEM)
|
||||||
|
error = ERANGE;
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
error = copyout(retbuf, uap->buf, buflen);
|
error = copyout(retbuf, uap->buf, buflen);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user