From cb88b7c214511736fa3bc1d9e57b23efcc61d8ab Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Fri, 27 Jan 2023 21:25:27 +0100 Subject: [PATCH] linux-user: Fix SO_ERROR return code of getsockopt() Add translation for the host error return code of: getsockopt(19, SOL_SOCKET, SO_ERROR, [ECONNREFUSED], [4]) = 0 This fixes the testsuite of the cockpit debian package with a hppa-linux guest on a x86-64 host. Signed-off-by: Helge Deller Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 210db5f0be..1c42df6518 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2758,8 +2758,13 @@ get_timeout: ret = get_errno(getsockopt(sockfd, level, optname, &val, &lv)); if (ret < 0) return ret; - if (optname == SO_TYPE) { + switch (optname) { + case SO_TYPE: val = host_to_target_sock_type(val); + break; + case SO_ERROR: + val = host_to_target_errno(val); + break; } if (len > lv) len = lv;