linuxulator: return EBADF for O_PATH mmap()
This fixes LTP open13, which expects O_PATH mmap() to fail with EBADF, but FreeBSD returned EACCES. Signed-off-by: YAO, Xin <mr.yaoxin@outlook.com> PR: 295571 Reviewed by: kib Pull-Request: https://github.com/freebsd/freebsd-src/pull/2233
This commit is contained in:
committed by
Pouria Mousavizadeh Tehrani
parent
a172f9e5b3
commit
30c85b7cb9
@@ -63,6 +63,10 @@ static int
|
||||
linux_mmap_check_fp(struct file *fp, int flags, int prot, int maxprot)
|
||||
{
|
||||
|
||||
/* Linux returns EBADF if mmap() is called on an O_PATH file descriptor */
|
||||
if (fp->f_ops == &path_fileops)
|
||||
return (EBADF);
|
||||
|
||||
/* Linux mmap() just fails for O_WRONLY files */
|
||||
if ((fp->f_flag & FREAD) == 0)
|
||||
return (EACCES);
|
||||
|
||||
Reference in New Issue
Block a user