From 90a6a0fff04975d1d9b81ed536337d156eb78d46 Mon Sep 17 00:00:00 2001 From: chenjintao Date: Mon, 21 Sep 2026 16:16:53 +0800 Subject: [PATCH] fix: correct OTA state file byte count checks --- ql-application/threadx/interface/custom_app/mqtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ql-application/threadx/interface/custom_app/mqtt.c b/ql-application/threadx/interface/custom_app/mqtt.c index f49d44c..2d91758 100644 --- a/ql-application/threadx/interface/custom_app/mqtt.c +++ b/ql-application/threadx/interface/custom_app/mqtt.c @@ -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; }