[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] slirp: Gcc 9 -O3 fix
From: |
Samuel Thibault |
Subject: |
Re: [Qemu-devel] [PATCH v2] slirp: Gcc 9 -O3 fix |
Date: |
Mon, 15 Apr 2019 14:03:28 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
Dr. David Alan Gilbert (git), le lun. 15 avril 2019 13:02:05 +0100, a ecrit:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> Gcc 9 needs some convincing that sopreprbuf really is going to fill
> in iov in the call from soreadbuf, even though the failure case
> shouldn't happen.
>
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> ---
> slirp/src/socket.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/slirp/src/socket.c b/slirp/src/socket.c
> index 4a3c935e25..beb8517f1c 100644
> --- a/slirp/src/socket.c
> +++ b/slirp/src/socket.c
> @@ -181,7 +181,7 @@ soread(struct socket *so)
> * No need to check if there's enough room to read.
> * soread wouldn't have been called if there weren't
> */
> - sopreprbuf(so, iov, &n);
> + assert(sopreprbuf(so, iov, &n) != 0);
Please make this through a variable, otherwise anybody building with
-DNDEBUG will get sopreprbuf not being called.
> nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
> if (nn <= 0) {
> @@ -257,6 +257,7 @@ int soreadbuf(struct socket *so, const char *buf, int
> size)
> * No need to check if there's enough room to read.
> * soread wouldn't have been called if there weren't
> */
> + assert(size > 0);
> if (sopreprbuf(so, iov, &n) < size)
> goto err;
>
> --
> 2.21.0
>