From e288b3334358bc9608454ec63e63334d92f39f80 Mon Sep 17 00:00:00 2001 From: Steve Mokris Date: Thu, 14 Apr 2022 15:26:50 -0400 Subject: OS-8376 Alter LX's unlinkat error code to match Linux kernel Reviewed by: Dan McDonald Approved by: Brian Bennett --- usr/src/uts/common/brand/lx/syscall/lx_link.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr/src/uts/common/brand/lx/syscall/lx_link.c b/usr/src/uts/common/brand/lx/syscall/lx_link.c index c4e8fbc93c..f2e268771e 100644 --- a/usr/src/uts/common/brand/lx/syscall/lx_link.c +++ b/usr/src/uts/common/brand/lx/syscall/lx_link.c @@ -154,6 +154,11 @@ lx_unlinkat(int atfd, char *path, int flag) if (lx_isdir(atfd, path)) return (set_errno(EISDIR)); } + if (err == EEXIST && (flag & AT_REMOVEDIR)) { + /* On Linux, an unlink of a non-empty dir returns ENOTEMPTY, not EEXIST. */ + if (lx_isdir(atfd, path)) + return (set_errno(ENOTEMPTY)); + } return (err); } -- cgit v1.2.3