From 0574f03817a08ae89a01f42716e39a6ac5fb6565 Mon Sep 17 00:00:00 2001 From: Seungyoun Ju Date: Thu, 8 Nov 2012 11:52:13 +0900 Subject: [PATCH] Prevent issues are fixed and unnecessary BT API call is removed - Issues 1. There is resource leakage. 2. There is unnecessary BT API call. - Fix description In error handling, resources are closed properly. Unnecessary BT API call is removed. Change-Id: Ib8805da8608cb06c03a96c5313a26d035e8932e6 --- packaging/mobileap-agent.spec | 8 +++++++- src/mobileap_agent.c | 6 +++++- src/mobileap_bluetooth.c | 9 --------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packaging/mobileap-agent.spec b/packaging/mobileap-agent.spec index be044fc..abade4a 100644 --- a/packaging/mobileap-agent.spec +++ b/packaging/mobileap-agent.spec @@ -1,6 +1,6 @@ Name: mobileap-agent Summary: Mobile AP daemon for setting tethering environments -Version: 0.1.76 +Version: 0.1.78 Release: 1 Group: TO_BE/FILLED_IN License: Apache License Version 2.0 @@ -48,6 +48,12 @@ rm -rf %{buildroot} %{_bindir}/mobileap-agent %changelog +* Tue Nov 06 2012 Seungyoun Ju 0.1.78-1 +- Unnecessary BT API is removed + +* Sat Nov 03 2012 Seungyoun Ju 0.1.77-1 +- Prevent issues are fixed + * Tue Oct 30 2012 Seungyoun Ju 0.1.76-1 - Vconf enum is changed (SETTING_USB_MOBILE_HOTSPOT -> SETTING_USB_TETHERING_MODE) - Private code is separated diff --git a/src/mobileap_agent.c b/src/mobileap_agent.c index 3728033..1e0eae8 100644 --- a/src/mobileap_agent.c +++ b/src/mobileap_agent.c @@ -660,6 +660,7 @@ int _mh_core_enable_softap(const char *ssid, const char *security, if ((sock_fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { ERR("Failed to open socket...!!!\n"); ret_status = MOBILE_AP_ERROR_RESOURCE; + break; } snprintf(cmd, MAX_BUF_SIZE, "ASCII_CMD=AP_CFG," @@ -766,7 +767,8 @@ int _mh_core_disable_softap(void) case MOBILE_AP_WEXT: if ((sock_fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { ERR("Failed to open socket...!!!\n"); - return MOBILE_AP_ERROR_RESOURCE; + ret_status = MOBILE_AP_ERROR_RESOURCE; + break; } /* Stop broadcasting of BSS. */ @@ -1015,6 +1017,7 @@ int _mh_core_enable_masquerade(const char *ext_if) if (write(fd, "1", 1) != 1) { ERR("write failed\n"); + close(fd); return MOBILE_AP_ERROR_INTERNAL; } close(fd); @@ -1046,6 +1049,7 @@ int _mh_core_disable_masquerade(const char *ext_if) if (write(fd, "0", 1) != 1) { ERR("write failed\n"); + close(fd); return MOBILE_AP_ERROR_INTERNAL; } close(fd); diff --git a/src/mobileap_bluetooth.c b/src/mobileap_bluetooth.c index 86418c4..7e0edd8 100644 --- a/src/mobileap_bluetooth.c +++ b/src/mobileap_bluetooth.c @@ -182,15 +182,6 @@ static void __bt_nap_connection_changed(bool connected, const char *remote_addre static mobile_ap_error_code_e __activate_bt_nap(MobileAPObject *obj) { int bt_ret = BT_ERROR_NONE; - bt_adapter_visibility_mode_e mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE; - - bt_ret = bt_adapter_get_visibility(&mode); - if (bt_ret != BT_ERROR_NONE) - ERR("bt_adapter_get_visibility is failed : %d\n", bt_ret); - else - DBG("Bluetooth is %s\n", mode != - BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE ? - "visible" : "invisible"); bt_ret = bt_nap_set_connection_state_changed_cb(__bt_nap_connection_changed, (void *)obj); if (bt_ret != BT_ERROR_NONE) { -- 2.7.4