fs/mmap: only MAP_SHARED mapping need file write permisson
If MAP_PRIVATE is specified, do not change the underlying object, that is OK to open file with read-only permission. Change to pass: testcases/open_posix_testsuite/conformance/interfaces/mmap/6-5.c Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
This commit is contained in:
parent
d892cda167
commit
d1825a7acb
@ -118,7 +118,8 @@ static int file_mmap_(FAR struct file *filep, FAR void *start,
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
if ((filep->f_oflags & O_WROK) == 0 && prot == PROT_WRITE)
|
||||
if ((flags & MAP_SHARED) &&
|
||||
(filep->f_oflags & O_WROK) == 0 && prot == PROT_WRITE)
|
||||
{
|
||||
ferr("ERROR: Unsupported options for read-only file descriptor,"
|
||||
"prot=%x flags=%04x\n", prot, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user