diff mbox series

[2/4] downloader: do not execute post command if install failed

Message ID 20210408052542.3509794-2-dominique.martinet@atmark-techno.com
State Accepted
Headers show
Series [1/4] archive_handler: make 'missing path attribute' message an ERROR | expand

Commit Message

Dominique Martinet April 8, 2021, 5:25 a.m. UTC
download_from_url should not ignore errors from ipc_wait_for_complete
ipc_wait_for_complete should loop at least once: make sure msg status is
not IDLE

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
 corelib/downloader.c | 4 +++-
 ipc/network_ipc.c    | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Stefano Babic April 8, 2021, 4:32 p.m. UTC | #1
On 08.04.21 07:25, Dominique Martinet wrote:
> download_from_url should not ignore errors from ipc_wait_for_complete
> ipc_wait_for_complete should loop at least once: make sure msg status is
> not IDLE
> 
> Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
> ---
>   corelib/downloader.c | 4 +++-
>   ipc/network_ipc.c    | 1 +
>   2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/corelib/downloader.c b/corelib/downloader.c
> index 6d6a132fd307..f1fae583d9c2 100644
> --- a/corelib/downloader.c
> +++ b/corelib/downloader.c
> @@ -54,7 +54,9 @@ static RECOVERY_STATUS download_from_url(channel_data_t* channel_data)
>   	if (chanresult != CHANNEL_OK) {
>   		result = FAILURE;
>   	}
> -	ipc_wait_for_complete(NULL);
> +	result = ipc_wait_for_complete(NULL);
> +	if (result == FAILURE)
> +		result = FAILURE;
>   	channel->close(channel);
>   	free(channel);
>   	return result;
> diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c
> index 767079da389d..07d81802912b 100644
> --- a/ipc/network_ipc.c
> +++ b/ipc/network_ipc.c
> @@ -246,6 +246,7 @@ int ipc_wait_for_complete(getstatus callback)
>   	int ret;
>   	
>   	message.data.status.last_result = FAILURE;
> +	message.data.status.current = RUN;
>   
>   	do {
>   		fd = prepare_ipc();
> 

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
Dominique Martinet April 8, 2021, 11:58 p.m. UTC | #2
Stefano Babic wrote on Thu, Apr 08, 2021 at 06:32:36PM +0200:
> On 08.04.21 07:25, Dominique Martinet wrote:
> > ipc_wait_for_complete should loop at least once: make sure msg status is
> > not IDLE
...
> > diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c
> > index 767079da389d..07d81802912b 100644
> > --- a/ipc/network_ipc.c
> > +++ b/ipc/network_ipc.c
> > @@ -246,6 +246,7 @@ int ipc_wait_for_complete(getstatus callback)
> >   	int ret;
> >   	
> >   	message.data.status.last_result = FAILURE;
> > +	message.data.status.current = RUN;
> >   	do {
> >   		fd = prepare_ipc();
> > 

Sorry, this part of the patch does not seem to be required -- the do
while loop will always read a full mesage in __ipc_get_status unless the
fd cannot be obtained (in which case we get a failure anyway)

I am not quite sure why I thought it was, but I re-ran tests without it
just fine now.


It doesn't hurt, but shall I send a v2 without it or can you take it
out?
diff mbox series

Patch

diff --git a/corelib/downloader.c b/corelib/downloader.c
index 6d6a132fd307..f1fae583d9c2 100644
--- a/corelib/downloader.c
+++ b/corelib/downloader.c
@@ -54,7 +54,9 @@  static RECOVERY_STATUS download_from_url(channel_data_t* channel_data)
 	if (chanresult != CHANNEL_OK) {
 		result = FAILURE;
 	}
-	ipc_wait_for_complete(NULL);
+	result = ipc_wait_for_complete(NULL);
+	if (result == FAILURE)
+		result = FAILURE;
 	channel->close(channel);
 	free(channel);
 	return result;
diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c
index 767079da389d..07d81802912b 100644
--- a/ipc/network_ipc.c
+++ b/ipc/network_ipc.c
@@ -246,6 +246,7 @@  int ipc_wait_for_complete(getstatus callback)
 	int ret;
 	
 	message.data.status.last_result = FAILURE;
+	message.data.status.current = RUN;
 
 	do {
 		fd = prepare_ipc();