From c4c6b2beb3c49c257a30db4eafbfaf7ae0396247 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Dutta <vivek.dutta@iopsys.eu> Date: Fri, 30 May 2025 13:29:54 +0530 Subject: [PATCH] fwbank: invert upgrade result check fwbank calls sysupgrade with upgrade method, which internally calls exec without closing the open fd in child process, which cause missing result output with upgrade calls. upgrade method updated to invert the logic and return failure in result, if input validation fails, final validation will be done base on `sysupgrade` ubus event. --- src/fwbank.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fwbank.c b/src/fwbank.c index 251f631..74c6856 100644 --- a/src/fwbank.c +++ b/src/fwbank.c @@ -469,15 +469,15 @@ static bool is_upgrade_success(struct blob_buf *output_bb) // Parse the blob buffer for the "result" field if (blobmsg_parse(&policy, 1, &tb, blobmsg_data(output_bb->head), blobmsg_len(output_bb->head)) != 0) { - BBFDM_ERR("Failed to parse blobmsg data"); - return false; + BBFDM_INFO("Failed to parse upgrade result, assuming success"); + return true; } // Check if the "result" field exists and is of the correct type if (tb && blobmsg_type(tb) == BLOBMSG_TYPE_STRING) - return (strcmp(blobmsg_get_string(tb), "ok") == 0) ? true : false; + return (strcmp(blobmsg_get_string(tb), "failure") == 0) ? false : true; - return false; + return true; } struct blob_buf *sysmngr_fwbank_dump(void) -- GitLab