Commit ab1a91d9 authored by Edward Tomasz Napierala's avatar Edward Tomasz Napierala
Browse files

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 <>
Reviewed By:	kib
Sponsored By:	The FreeBSD Foundation
Differential Revision:

(cherry picked from commit 0dfbdd9f)
parent 0264d12e
......@@ -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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment