From 47fbcdcdd5eaecbf69bf3befcb0d4ec444dfb030 Mon Sep 17 00:00:00 2001 From: Shrikant Temburwar Date: Tue, 17 Sep 2024 21:58:31 +0530 Subject: [PATCH] Fix multiple file download for FSIM fdo.download Signed-off-by: Shrikant Temburwar --- device_modules/fdo_sim/fdo_sim_download.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/device_modules/fdo_sim/fdo_sim_download.c b/device_modules/fdo_sim/fdo_sim_download.c index 0945fd4f..6f58bcff 100644 --- a/device_modules/fdo_sim/fdo_sim_download.c +++ b/device_modules/fdo_sim/fdo_sim_download.c @@ -303,9 +303,12 @@ int fdo_sim_set_osi_write(size_t bin_len, uint8_t *bin_data) goto end; } - if (bytes_received == expected_len || !bin_len) { - // Entire file has been sent - bytes_received = 0; + if (!bin_len) { + if (!fdor_next(fdor)) { + LOG(LOG_ERROR, "Module fdo.download - Failed to read " + "fdo.download\n"); + goto end; + } result = FDO_SI_SUCCESS; goto end; } @@ -406,6 +409,7 @@ int fdo_sim_set_osi_write(size_t bin_len, uint8_t *bin_data) if (file_data) { FSIMModuleFree(file_data); } + bytes_received = 0; } result = fdo_sim_end(&fdor, &fdow, result, bin_data, NULL, 0, &hasmore,