Not set le_static_addr when initializing 87/212787/1 accepted/tizen/unified/20190827.110641 submit/tizen/20190827.022419
authorDeokhyun Kim <dukan.kim@samsung.com>
Tue, 27 Aug 2019 01:46:36 +0000 (10:46 +0900)
committerDeokhyun Kim <dukan.kim@samsung.com>
Tue, 27 Aug 2019 01:46:36 +0000 (10:46 +0900)
Change-Id: Iebd1a33c9ffb28635336018b71cd817b2ca166d5
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
src/adapter.c

index 69be970..1d3b879 100644 (file)
@@ -5083,7 +5083,6 @@ static void init_le_static_address(struct btd_adapter *adapter)
        } else {
                error("Cannot save LE address");
        }
-       bacpy(&adapter->le_static_addr, &le_static_addr);
 }
 
 static void set_le_static_address(struct btd_adapter *adapter)
@@ -5094,24 +5093,23 @@ static void set_le_static_address(struct btd_adapter *adapter)
        char dirname[PATH_MAX];
 
        snprintf(dirname, PATH_MAX, STORAGEDIR "/%s", "le_static_addr");
-       if (access(dirname, F_OK) < 0) {
+       if (access(dirname, F_OK) < 0)
                init_le_static_address(adapter);
+
+       fd = open(dirname, O_RDONLY);
+       if (fd >= 0) {
+               ret = read(fd, address, sizeof(address));
+               if (ret >= 17) {
+                       /* xx:xx:xx:xx:xx:xx */
+                       address[17] = '\0';
+                       DBG("LE static random : %s", address);
+                       str2ba(address, &adapter->le_static_addr);
+                       adapter->le_static_addr.b[5] |= 0xc0;
+               } else
+                       error("Invalid LE address");
+               close(fd);
        } else {
-               fd = open(dirname, O_RDONLY);
-               if (fd >= 0) {
-                       ret = read(fd, address, sizeof(address));
-                       if (ret >= 17) {
-                               /* xx:xx:xx:xx:xx:xx */
-                               address[17] = '\0';
-                               DBG("LE static random : %s", address);
-                               str2ba(address, &adapter->le_static_addr);
-                               adapter->le_static_addr.b[5] |= 0xc0;
-                       } else
-                               error("Invalid LE address");
-                       close(fd);
-               } else {
-                       error("Cannot get LE address");
-               }
+               error("Cannot get LE address");
        }
 
        return;