From: Matus Kysel Date: Wed, 30 Sep 2020 15:16:16 +0000 (+0200) Subject: linux-user: correct errno returned from accept4() syscall X-Git-Tag: v5.2.0-rc0~25^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e554eb4bb56395b1e3b7042dc6974dc87de3f4d1;p=thirdparty%2Fqemu.git linux-user: correct errno returned from accept4() syscall accept4() returned wrong errno, that did not match current linux Signed-off-by: Matus Kysel Reviewed-by: Laurent Vivier Message-Id: <20200930151616.3588165-1-mkysel@tachyum.com> Signed-off-by: Laurent Vivier --- diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f0df6aecef8..6fef8181e73 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3491,16 +3491,16 @@ static abi_long do_accept4(int fd, abi_ulong target_addr, return get_errno(safe_accept4(fd, NULL, NULL, host_flags)); } - /* linux returns EINVAL if addrlen pointer is invalid */ + /* linux returns EFAULT if addrlen pointer is invalid */ if (get_user_u32(addrlen, target_addrlen_addr)) - return -TARGET_EINVAL; + return -TARGET_EFAULT; if ((int)addrlen < 0) { return -TARGET_EINVAL; } if (!access_ok(VERIFY_WRITE, target_addr, addrlen)) - return -TARGET_EINVAL; + return -TARGET_EFAULT; addr = alloca(addrlen);