net: close socket after checking available port
authorMunkyu Im <munkyu.im@samsung.com>
Wed, 30 Dec 2015 02:04:11 +0000 (11:04 +0900)
committerMunkyu Im <munkyu.im@samsung.com>
Wed, 30 Dec 2015 04:50:16 +0000 (13:50 +0900)
fixed check_port_bind_listen() in 6ae322880b2a6f4de42bd25c9f19ccce870136cd
But one caller of this function was skipped closing socket.
So, this commit adds socket close.

Change-Id: Id204f7e3bd15111019ae86cbacaa75111edd59fd
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
(cherry picked from commit 4927bf7af5912f8ab4c2cf4b10a259ef5ef85f3b)
(cherry picked from commit 379fad4bf085164611a3b1d68e4d7f95a85b88da)

tizen/src/util/osutil-linux.c

index c3e318ee2f5e3c6ea91ff63c458eeda990d455a8..47959987518f1549799d1ed5d6641fa4714b0c19 100644 (file)
@@ -43,6 +43,7 @@
 #include <sys/utsname.h>
 #include <sys/sysinfo.h>
 
+#include "qemu/sockets.h"
 #include "qemu/error-report.h"
 
 #include "osutil.h"
@@ -84,8 +85,10 @@ void check_vm_lock_os(void)
                     shm_info.shm_nattch);
                 if ((shm_info.shm_nattch > 0) &&
                     g_strcmp0(get_drive_image_file(), (char *)shm_addr) == 0) {
-                    if (check_port_bind_listen(port + 1) > 0) {
+                    int ret = 0;
+                    if ((ret = check_port_bind_listen(port + 1)) > 0) {
                         shmdt(shm_addr);
+                        closesocket(ret);
                         continue;
                     }
                     shmdt(shm_addr);