[Title] change the call order bind & setsocketopt(SO_REUSEADDR) for multi instanc...
authordongkyun.yun <dk77.yun@samsung.com>
Sun, 4 Dec 2011 13:23:16 +0000 (22:23 +0900)
committerdongkyun.yun <dk77.yun@samsung.com>
Sun, 4 Dec 2011 13:23:16 +0000 (22:23 +0900)
[Type]      Bugfix
[Module]    // Module Name - (Main / Sub)
[Priority]  // Importance : Critical / Major / Minor
[CQ#]       // CQ Issue Number
[Redmine#]  // Redmine Isuue Number
[Problem]   // Problem Description
[Cause]     // Cause Description
[Solution]  // Solution Description
[TestCase]  // Executed the test-target (How to)

sdb.c
slirp/socket.c

diff --git a/sdb.c b/sdb.c
index c4f13c5..f06b84f 100644 (file)
--- a/sdb.c
+++ b/sdb.c
@@ -214,8 +214,8 @@ static int check_port_bind_listen(u_int port)
        addr.sin_port = htons(port);
 
        if (((s = qemu_socket(AF_INET,SOCK_STREAM,0)) < 0) ||
-                       (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
                        (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
+                       (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
                        (listen(s,1) < 0)) {
 
                /* fail */
index 6119234..c97691c 100644 (file)
@@ -624,8 +624,8 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
        addr.sin_port = hport;
 
        if (((s = qemu_socket(AF_INET,SOCK_STREAM,0)) < 0) ||
-           (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
            (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
+           (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
            (listen(s,1) < 0)) {
                int tmperrno = errno; /* Don't clobber the real reason we failed */