Prevent issues are fixed and unnecessary BT API call is removed
authorSeungyoun Ju <sy39.ju@samsung.com>
Thu, 8 Nov 2012 02:52:13 +0000 (11:52 +0900)
committerSeungyoun Ju <sy39.ju@samsung.com>
Thu, 8 Nov 2012 02:52:13 +0000 (11:52 +0900)
- 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
src/mobileap_agent.c
src/mobileap_bluetooth.c

index be044fc..abade4a 100644 (file)
@@ -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 <sy39.ju@samsung.com> 0.1.78-1
+- Unnecessary BT API is removed
+
+* Sat Nov 03 2012 Seungyoun Ju <sy39.ju@samsung.com> 0.1.77-1
+- Prevent issues are fixed
+
 * Tue Oct 30 2012 Seungyoun Ju <sy39.ju@samsung.com> 0.1.76-1
 - Vconf enum is changed (SETTING_USB_MOBILE_HOTSPOT -> SETTING_USB_TETHERING_MODE)
 - Private code is separated
index 3728033..1e0eae8 100644 (file)
@@ -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);
index 86418c4..7e0edd8 100644 (file)
@@ -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) {