Skip to content

Commit

Permalink
src/bundle: check rm_tree() return values
Browse files Browse the repository at this point in the history
Fixes coverity warnings and provides hints for the user that something
went wrong.

Signed-off-by: Enrico Joerns <[email protected]>
  • Loading branch information
ejoerns committed Oct 18, 2024
1 parent d2136ac commit 9ec288b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,12 @@ static gboolean decrypt_bundle_payload(RaucBundle *bundle, GError **error)
out:
/* Remove temporary bundle creation directory.
* RAUC will still have access to the decrypted bundle via the opened GFile */
if (tmpdir)
rm_tree(tmpdir, NULL);
if (tmpdir) {
g_autoptr(GError) tmperror = NULL;
if (!rm_tree(tmpdir, &tmperror)) {
g_warning("Failed to remove bundle decryption tmpdir %s: %s", tmpdir, tmperror->message);
}
}

return res;
}
Expand Down Expand Up @@ -1516,8 +1520,12 @@ static gboolean convert_to_casync_bundle(RaucBundle *bundle, const gchar *outbun
res = TRUE;
out:
/* Remove temporary bundle creation directory */
if (tmpdir)
rm_tree(tmpdir, NULL);
if (tmpdir) {
g_autoptr(GError) tmperror = NULL;
if (!rm_tree(tmpdir, &tmperror)) {
g_warning("Failed to remove conversion tmpdir %s: %s", tmpdir, tmperror->message);
}
}
return res;
}

Expand Down Expand Up @@ -2735,8 +2743,12 @@ gboolean load_manifest_from_bundle(RaucBundle *bundle, RaucManifest **manifest,
goto out;
}
out:
if (tmpdir)
rm_tree(tmpdir, NULL);
if (tmpdir) {
g_autoptr(GError) tmperror = NULL;
if (!rm_tree(tmpdir, &tmperror)) {
g_warning("Failed to remove unsquashfs tmpdir %s: %s", tmpdir, tmperror->message);
}
}
return res;
}

Expand Down

0 comments on commit 9ec288b

Please sign in to comment.