From: Helge Deller <deller@gmx.de>
To: Laurent Vivier <laurent@vivier.eu>
Cc: Helge Deller <deller@gmx.de>,
Richard Henderson <richard.henderson@linaro.org>,
qemu-devel@nongnu.org
Subject: [PATCH v2] linux-user: Fix SO_ERROR return code of getsockopt()
Date: Fri, 27 Jan 2023 21:25:27 +0100 [thread overview]
Message-ID: <Y9QzNzXg0hrzHQeo@p100> (raw)
In-Reply-To: <059795f6-97f0-b112-1802-fc47668986a5@vivier.eu>
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 <deller@gmx.de>
---
v2: Fix indenting to make checkscript.sh happy
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index dac0cfe6c4..06e8612675 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2809,8 +2809,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;
next prev parent reply other threads:[~2023-01-27 20:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 10:10 [PATCH] linux-user: Fix SO_ERROR return code of getsockopt() Helge Deller
2023-01-26 16:55 ` Laurent Vivier
2023-01-26 18:27 ` Helge Deller
2023-01-26 19:43 ` Laurent Vivier
2023-01-27 20:25 ` Helge Deller [this message]
2023-01-27 22:55 ` [PATCH v2] " Richard Henderson
2023-01-30 8:42 ` Laurent Vivier
2023-01-30 8:45 ` Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y9QzNzXg0hrzHQeo@p100 \
--to=deller@gmx.de \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).