summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Mokris <smokris@softpixel.com>2022-04-14 15:26:50 -0400
committerGitHub <noreply@github.com>2022-04-14 15:26:50 -0400
commite288b3334358bc9608454ec63e63334d92f39f80 (patch)
tree090061fb81255aa329be381fdd47ac7c1f6c1a80
parentb2150b743e9c9ef73396118ab99a57905f270845 (diff)
downloadillumos-joyent-e288b3334358bc9608454ec63e63334d92f39f80.tar.gz
OS-8376 Alter LX's unlinkat error code to match Linux kernel
Reviewed by: Dan McDonald <danmcd@joyent.com> Approved by: Brian Bennett <brian.bennett@joyent.com>
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_link.c5
1 files changed, 5 insertions, 0 deletions
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);
}