aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2021-03-12 15:31:37 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2021-03-12 15:31:45 +0000
commit0dfbdd9fc269f0438ffcc31632d35234a90584ad (patch)
tree5c053b70e0794a12a042a51d0a2a4a4880e959b8
parentcecfaf9bede9665d6a10f1e575cd5d575450cff7 (diff)
downloadsrc-0dfbdd9fc269f0438ffcc31632d35234a90584ad.tar.gz
src-0dfbdd9fc269f0438ffcc31632d35234a90584ad.zip
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
-rw-r--r--sys/compat/linux/linux_getcwd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c
index c39e69c4e707..4917641be5e5 100644
--- a/sys/compat/linux/linux_getcwd.c
+++ b/sys/compat/linux/linux_getcwd.c
@@ -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)