aboutsummaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2019-04-15 20:10:02 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-04-15 20:10:02 +0200
commit59a1b1f165458c2acb7ff0525b543945f7416225 (patch)
tree00782261ffb5ee21664d2154f031628367e56cac /src/socket.c
parent1daa4606281a14bc0be63fba98be7723befbd96a (diff)
downloadslirp-59a1b1f165458c2acb7ff0525b543945f7416225.zip
slirp-59a1b1f165458c2acb7ff0525b543945f7416225.tar.gz
slirp-59a1b1f165458c2acb7ff0525b543945f7416225.tar.bz2
Gcc 9 -O3 fix
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>
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c
index 51f5f8a..34daffc 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -168,6 +168,7 @@ size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np)
int soread(struct socket *so)
{
int n, nn;
+ size_t buf_len;
struct sbuf *sb = &so->so_snd;
struct iovec iov[2];
@@ -178,7 +179,8 @@ int 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) {
@@ -253,6 +255,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;