Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0def10b2 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by android-build-merger
Browse files

Treat empty/truncated GATT cache as error

am: 51d5b33d

* commit '51d5b33d':
  Treat empty/truncated GATT cache as error
parents be5acf3f 51d5b33d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -120,6 +120,9 @@ void bta_gattc_co_cache_load(BD_ADDR server_bda, UINT16 evt, UINT16 start_index,
    if (sCacheFD && (0 == fseek(sCacheFD, start_index * sizeof(tBTA_GATTC_NV_ATTR), SEEK_SET)))
    {
        num_attr = fread(attr, sizeof(tBTA_GATTC_NV_ATTR), BTA_GATTC_NV_LOAD_MAX, sCacheFD);
        if (start_index == 0 && num_attr < 1)
            status = BTA_GATT_ERROR; // Cache truncated
        else
            status = (num_attr < BTA_GATTC_NV_LOAD_MAX ? BTA_GATT_OK : BTA_GATT_MORE);
    }