diff options
author | netchild <netchild@FreeBSD.org> | 2006-09-10 13:47:56 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2006-09-10 13:47:56 +0000 |
commit | c12753e19434bed1e4d514aacbd4f5bd79d06926 (patch) | |
tree | bae8eb22d5de58b114432e3c26fa9e9002a5a4bd /sys | |
parent | d06bfaa1a96c6da560cc7f02256c7b4f8d4607ef (diff) | |
download | FreeBSD-src-c12753e19434bed1e4d514aacbd4f5bd79d06926.zip FreeBSD-src-c12753e19434bed1e4d514aacbd4f5bd79d06926.tar.gz |
The Linux unlink syscall uses a different errno value when trying to unlink
a directory.
PR: 102897 [1]
Noticed by: Knut Anders Hatlen <kahatlen@gmail.com>, testrun with LTP [1]
Submitted by: Marcin Cieslak <saper@SYSTEM.PL>
Tested by: netchild (LTP test run)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/linux/linux_file.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index cd50aa4..327f604 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mount.h> #include <sys/mutex.h> #include <sys/proc.h> +#include <sys/stat.h> #include <sys/syscallsubr.h> #include <sys/sysproto.h> #include <sys/tty.h> @@ -495,6 +496,7 @@ linux_unlink(struct thread *td, struct linux_unlink_args *args) { char *path; int error; + struct stat st; LCONVPATHEXIST(td, args->path, &path); @@ -504,6 +506,11 @@ linux_unlink(struct thread *td, struct linux_unlink_args *args) #endif error = kern_unlink(td, path, UIO_SYSSPACE); + if (error == EPERM) + /* Introduce POSIX noncompliant behaviour of Linux */ + if (kern_stat(td, path, UIO_SYSSPACE, &st) == 0) + if (S_ISDIR(st.st_mode)) + error = EISDIR; LFREEPATH(path); return (error); } |