readv.2: Fix wrong errno for an unknown flag

[I got two patches for this; the other from Florian Weimer]

According to the following kernel code, preadv2(2)/pwritev2(2) with
an unknown flag actually returned EOPNOTSUPP instead of EINVAL:
----------------------------------------------------------------
static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
{
	if (unlikely(flags & ~RWF_SUPPORTED)) {
		return -EOPNOTSUPP;
	}
	...
}

static ssize_t do_loop_readv_writev(struct file *filp, struct iov_iter *iter,
		loff_t *ppos, int type, rwf_t flags)
{
	...
	if (flags & ~RWF_HIPRI)
		return -EOPNOTSUPP;
	...
}

Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Xiao Yang 2018-10-05 10:50:24 +08:00 committed by Michael Kerrisk
parent ebbbcd36d6
commit 63c1260a32
1 changed files with 1 additions and 1 deletions

View File

@ -312,7 +312,7 @@ The vector count,
.IR iovcnt ,
is less than zero or greater than the permitted maximum.
.TP
.B EINVAL
.B EOPNOTSUPP
An unknown flag is specified in \fIflags\fP.
.SH VERSIONS
.BR preadv ()