aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>2013-02-22 12:39:49 +0900
committerStefan Hajnoczi <stefanha@redhat.com>2013-03-04 09:54:17 +0100
commitaf3f4e7aa417f88b9884f49ebddcf1343c2b1c85 (patch)
tree1135b9a60184346c9a655a62c068464c84181838
parent8b3706dae059856a1c6f1914f76ad35e602fa6f4 (diff)
downloadslirp-af3f4e7aa417f88b9884f49ebddcf1343c2b1c85.zip
slirp-af3f4e7aa417f88b9884f49ebddcf1343c2b1c85.tar.gz
slirp-af3f4e7aa417f88b9884f49ebddcf1343c2b1c85.tar.bz2
slirp/tcp_subr.c: fix coding style in tcp_connect
Fix coding style in tcp_connect before the next patch. Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--tcp_subr.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/tcp_subr.c b/tcp_subr.c
index d55259e..636b0a9 100644
--- a/tcp_subr.c
+++ b/tcp_subr.c
@@ -403,7 +403,8 @@ void tcp_connect(struct socket *inso)
/* FACCEPTONCE already have a tcpcb */
so = inso;
} else {
- if ((so = socreate(slirp)) == NULL) {
+ so = socreate(slirp);
+ if (so == NULL) {
/* If it failed, get rid of the pending connection */
closesocket(accept(inso->s, (struct sockaddr *)&addr, &addrlen));
return;
@@ -416,9 +417,10 @@ void tcp_connect(struct socket *inso)
so->so_lport = inso->so_lport;
}
- (void)tcp_mss(sototcpcb(so), 0);
+ tcp_mss(sototcpcb(so), 0);
- if ((s = accept(inso->s, (struct sockaddr *)&addr, &addrlen)) < 0) {
+ s = accept(inso->s, (struct sockaddr *)&addr, &addrlen);
+ if (s < 0) {
tcp_close(sototcpcb(so)); /* This will sofree() as well */
return;
}
@@ -441,11 +443,12 @@ void tcp_connect(struct socket *inso)
/* Close the accept() socket, set right state */
if (inso->so_state & SS_FACCEPTONCE) {
- closesocket(
- so->s); /* If we only accept once, close the accept() socket */
- so->so_state =
- SS_NOFDREF; /* Don't select it yet, even though we have an FD */
+ /* If we only accept once, close the accept() socket */
+ closesocket(so->s);
+
+ /* Don't select it yet, even though we have an FD */
/* if it's not FACCEPTONCE, it's already NOFDREF */
+ so->so_state = SS_NOFDREF;
}
so->s = s;
so->so_state |= SS_INCOMING;