From dfe91e5e34bf866fe2231b93b1a910e159d02d64 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Mon, 18 Nov 2019 10:19:16 +0000 Subject: [PATCH] Make linux(4) open(2)/openat(2) return ELOOP instead of EMLINK, when being passed O_NOFOLLOW. This fixes LTP testcase openat02:5. Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22384 --- sys/compat/linux/linux_file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 778ad77daf9..6302a053875 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -132,8 +132,11 @@ linux_common_open(struct thread *td, int dirfd, char *path, int l_flags, int mod /* XXX LINUX_O_NOATIME: unable to be easily implemented. */ error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode); - if (error != 0) + if (error != 0) { + if (error == EMLINK) + error = ELOOP; goto done; + } if (bsd_flags & O_NOCTTY) goto done;