Skip to content

Commit

Permalink
fix: check that the update module is set in mender_download_artifact
Browse files Browse the repository at this point in the history
Due to `artifact_read_data_prepare` not being called when an artifact
doesn't have any files, the update module might be NULL after
`mender_http_artifact_download` returns MENDER_OK.

Add an explicit check to ensure this is caught.

Changelog: None
Ticket: MEN-7804

Signed-off-by: Daniel Skinstad Drabitzius <[email protected]>
  • Loading branch information
danielskinstad committed Jan 30, 2025
1 parent f2acb52 commit b4efb25
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/mender-artifact-download.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ mender_download_artifact(const char *uri, mender_deployment_data_t *deployment_d
return ret;
}

/* If the artifact doesn't contain a file, the update module won't be set */
if (NULL == dl_data.update_module) {
mender_log_error("No Update Module detected - check that the artifact contains a file");
return MENDER_FAIL;
}

/* Treatment depending of the status */
if (200 == status) {
/* Nothing to do */
Expand Down

0 comments on commit b4efb25

Please sign in to comment.