]> git.proxmox.com Git - mirror_qemu.git/commitdiff
slirp: Gcc 9 -O3 fix
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Mon, 15 Apr 2019 12:17:40 +0000 (13:17 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 15 Apr 2019 18:01:18 +0000 (20:01 +0200)
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 <dgilbert@redhat.com>
Message-Id: <20190415121740.9881-1-dgilbert@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
slirp/src/socket.c

index 4a3c935e253700819104ebdf66e84b9a0fb454a9..bb752fdcae4ece4915f6858369754f96057a434a 100644 (file)
@@ -171,6 +171,7 @@ int
 soread(struct socket *so)
 {
        int n, nn;
+       size_t buf_len;
        struct sbuf *sb = &so->so_snd;
        struct iovec iov[2];
 
@@ -181,7 +182,8 @@ 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);
+       buf_len = sopreprbuf(so, iov, &n);
+       assert(buf_len != 0);
 
        nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
        if (nn <= 0) {
@@ -257,6 +259,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;