From fa908e887a8246e8571980fd6da7c74e92dd5fdc Mon Sep 17 00:00:00 2001 From: Kitae Kim Date: Tue, 25 Mar 2014 11:16:58 +0900 Subject: [PATCH] tethering: improve error handling check return value when using socket api Change-Id: I0ef78504cd616457bbc112a7c14c3f7972972fb3 Signed-off-by: Kitae Kim --- tizen/src/tethering/app_tethering.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tizen/src/tethering/app_tethering.c b/tizen/src/tethering/app_tethering.c index 16f7599..8d28b11 100644 --- a/tizen/src/tethering/app_tethering.c +++ b/tizen/src/tethering/app_tethering.c @@ -30,7 +30,7 @@ #ifndef __WIN32 #include #else -#define EISCONN WSAEISCONN +#define EISCONN WSAEISCONN #endif #include "qemu-common.h" @@ -874,11 +874,15 @@ static int start_tethering_socket(int port) addr.sin_family = AF_INET; addr.sin_port = htons(port); // i.e. 1234 - inet_aton("127.0.0.1", &addr.sin_addr); + ret = inet_aton("127.0.0.1", &addr.sin_addr); + if (ret == 0) { + ERR("inet_aton failure\n"); + return -1; + } sock = qemu_socket(PF_INET, SOCK_STREAM, 0); if (sock < 0) { -// set_tethering_connection_status(DISCONNECTED); + // set_tethering_connection_status(DISCONNECTED); ERR("tethering socket creation is failed\n", sock); return -1; } @@ -894,7 +898,7 @@ static int start_tethering_socket(int port) } else { INFO("tethering socket is connected.\n"); ret = 0; -// set_tethering_app_state(true); + // set_tethering_app_state(true); break; } TRACE("ret: %d\n", ret); -- 2.7.4