slirp: Remove code that handles socreate() failure

Now that socreate() can never fail, we can remove the code
that was trying to handle that situation.

In particular this removes code in tcp_connect() that
provoked Coverity to complain (CID 1005724): in
 closesocket(accept(inso->s, (struct sockaddr *)&addr, &addrlen));
if the accept() call fails then we pass closesocket() -1
instead of a valid file descriptor.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
Peter Maydell 2018-11-06 15:13:22 +00:00 committed by Samuel Thibault
parent 84ec9bfaf2
commit 4ded9bb54c
7 changed files with 2 additions and 23 deletions

View file

@ -171,9 +171,6 @@ udp_input(register struct mbuf *m, int iphlen)
* create one
*/
so = socreate(slirp);
if (!so) {
goto bad;
}
if (udp_attach(so, AF_INET) == -1) {
DEBUG_MISC((dfd," udp_attach errno = %d-%s\n",
errno,strerror(errno)));
@ -331,9 +328,6 @@ udp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
socklen_t addrlen = sizeof(struct sockaddr_in);
so = socreate(slirp);
if (!so) {
return NULL;
}
so->s = qemu_socket(AF_INET,SOCK_DGRAM,0);
if (so->s < 0) {
sofree(so);