From: Laurent Vivier <laurent@vivier.eu>
To: Helge Deller <deller@gmx.de>,
Richard Henderson <richard.henderson@linaro.org>,
qemu-devel@nongnu.org
Subject: Re: [PATCH] linux-user: Fix SO_ERROR return code of getsockopt()
Date: Thu, 26 Jan 2023 17:55:07 +0100 [thread overview]
Message-ID: <8ec83c02-0e87-90c2-835d-e01a330b1969@vivier.eu> (raw)
In-Reply-To: <20221216101033.8352-1-deller@gmx.de>
Le 16/12/2022 à 11:10, Helge Deller a écrit :
> 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>
> ---
> linux-user/syscall.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index e541fbe09a..52693b4239 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -2809,8 +2809,9 @@ get_timeout:
> ret = get_errno(getsockopt(sockfd, level, optname, &val, &lv));
> if (ret < 0)
> return ret;
> - if (optname == SO_TYPE) {
> - val = host_to_target_sock_type(val);
> + switch (optname) {
> + case SO_TYPE: val = host_to_target_sock_type(val); break;
> + case SO_ERROR: val = host_to_target_errno(val); break;
It looks good but I think compiler will complain if you don't have a default case.
perhaps "if (optname == SO_TYPE) { } else if (optname == SO_ERROR) { }" would be better.
Thanks,
Laurent
> }
> if (len > lv)
> len = lv;
> --
> 2.38.1
>
>
next prev parent reply other threads:[~2023-01-26 16:55 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 [this message]
2023-01-26 18:27 ` Helge Deller
2023-01-26 19:43 ` Laurent Vivier
2023-01-27 20:25 ` [PATCH v2] " Helge Deller
2023-01-27 22:55 ` 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=8ec83c02-0e87-90c2-835d-e01a330b1969@vivier.eu \
--to=laurent@vivier.eu \
--cc=deller@gmx.de \
--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).