mmap.2: The file descriptor for a file mapping must be readable

There is no difference between MAP_SHARED and MAP_PRIVATE.

do_mmap_pgoff()
	switch (flags & MAP_TYPE) {
	case MAP_SHARED:
	...
	/* fall through */
	case MAP_PRIVATE:
		if (!(file->f_mode & FMODE_READ))
			return -EACCES;

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Andrey Vagin 2014-04-04 12:24:35 +04:00 committed by Michael Kerrisk
parent 5f7504ef28
commit 5e7c71f6ac
1 changed files with 1 additions and 3 deletions

View File

@ -393,9 +393,7 @@ is set (probably to
.TP
.B EACCES
A file descriptor refers to a non-regular file.
Or
.B MAP_PRIVATE
was requested, but
Or a file mapping was requested, but
.I fd
is not open for reading.
Or