mirror of
https://dev.iopsys.eu/system/sysmngr.git
synced 2025-12-10 00:06:19 +01:00
fwbank: invert upgrade result check
This commit is contained in:
parent
ed2496265b
commit
4adbdbb877
2 changed files with 5 additions and 7 deletions
|
|
@ -112,7 +112,7 @@ static bool fwbank_set_bootbank(const char *bank_id)
|
|||
static bool fwbank_upgrade(const char *path, bool activate, const char *bank_id, const char *keep_settings)
|
||||
{
|
||||
json_object *json_obj = NULL;
|
||||
bool res = false;
|
||||
bool res = true;
|
||||
|
||||
if (activate == false) {
|
||||
dmubus_call_blocking("fwbank", "upgrade", UBUS_ARGS{{"path", path, String}, {"auto_activate", "0", Boolean}, {"bank", bank_id, Integer}, {"keep_settings", "0", Boolean}}, 4, &json_obj);
|
||||
|
|
@ -123,8 +123,6 @@ static bool fwbank_upgrade(const char *path, bool activate, const char *bank_id,
|
|||
if (json_obj) {
|
||||
char *result = dmjson_get_value(json_obj, 1, "result");
|
||||
res = (DM_LSTRCMP(result, "ok") == 0) ? true : false;
|
||||
} else {
|
||||
res = false;
|
||||
}
|
||||
|
||||
if (json_obj != NULL)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue