fix: correct OTA state file byte count checks

This commit is contained in:
chenjintao
2026-09-21 16:16:53 +08:00
parent 56a8cd15e5
commit 90a6a0fff0
@@ -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;
}