In the previous code, osu returned 0 even if upgrade is failed, due to
the deinitialization code. Previously, if error occured during the
upgrade, aborted the rest works and called the deinitialization function
'update_control_deinitialize' and returned its return value.
This caused osu to return 0 even an error is occured, which is invalid
behavior.
To fix this issue, the return value of deinitialization function is
treated as a different variable.
Change-Id: Ie536bafc5bb4e31f461cf1df98db496d77a24664
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
int do_update(void)
{
int ret = 0;
+ int ret_deinit = 0;
+
ret = update_control_initialize();
if (ret != UPDATE_CONTROL_ERROR_NONE) {
printf("Failed to initialize: %d\n", ret);
printf("Succeed to trigger update: %d\n", ret);
cleanup:
- ret = update_control_deinitialize();
- if (ret != UPDATE_CONTROL_ERROR_NONE)
- printf("Failed to deinitialize: %d\n", ret);
+ ret_deinit = update_control_deinitialize();
+ if (ret_deinit != UPDATE_CONTROL_ERROR_NONE) {
+ printf("Failed to deinitialize: %d\n", ret_deinit);
+ return ret_deinit;
+ }
return ret;
}