fix: correct OTA state file byte count checks
This commit is contained in:
@@ -168,7 +168,7 @@ static int ota_state_save(const char *previous_version, const char *target_versi
|
||||
}
|
||||
|
||||
ret = ql_fwrite(&state, sizeof(state), 1, fp);
|
||||
if (ret != 1) {
|
||||
if (ret != (int)sizeof(state)) {
|
||||
RLOGE("OTA state write failed: %d", ret);
|
||||
ql_fclose(fp);
|
||||
ql_remove(OTA_STATE_TMP_FILE);
|
||||
@@ -211,7 +211,7 @@ static int ota_state_load(ota_state_t *state)
|
||||
memset(state, 0, sizeof(*state));
|
||||
ret = ql_fread(state, sizeof(*state), 1, fp);
|
||||
ql_fclose(fp);
|
||||
if (ret != 1) {
|
||||
if (ret != (int)sizeof(*state)) {
|
||||
RLOGE("OTA state read failed: %d", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user