mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
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)
This commit is contained in:
parent
d6b910d295
commit
db0d964062
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162201
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user