Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 2021 13:40:08 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ab1a91d95872 - stable/13 - linux(4): make getcwd(2) return ERANGE instead of ENOMEM
Message-ID:  <202103151340.12FDe8S0043162@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=ab1a91d95872e59db3d476be4fefb0b58df3afc4

commit ab1a91d95872e59db3d476be4fefb0b58df3afc4
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-03-12 15:31:37 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2021-03-15 13:00:17 +0000

    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
    
    (cherry picked from commit 0dfbdd9fc269f0438ffcc31632d35234a90584ad)
---
 sys/compat/linux/linux_getcwd.c | 2 ++
 1 file changed, 2 insertions(+)

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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103151340.12FDe8S0043162>