Patchwork fwts_exec: fix status check (LP: #1271607)

login
register
mail settings
Submitter Colin King
Date Jan. 22, 2014, 3:54 p.m.
Message ID <1390406089-14016-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/313285/
State Accepted
Headers show

Comments

Colin King - Jan. 22, 2014, 3:54 p.m.
From: Colin Ian King <colin.king@canonical.com>

fix inverted status check of exec calls. This is causing
uefi tests to fail because of module load/unload is
erroneously being reported to fail when it is in fact
succeeding.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_pipeio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Alex Hung - Jan. 23, 2014, 2:02 a.m.
On 01/22/2014 11:54 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> fix inverted status check of exec calls. This is causing
> uefi tests to fail because of module load/unload is
> erroneously being reported to fail when it is in fact
> succeeding.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_pipeio.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
> index 1f21ed7..df07295 100644
> --- a/src/lib/src/fwts_pipeio.c
> +++ b/src/lib/src/fwts_pipeio.c
> @@ -179,7 +179,8 @@ int fwts_exec(const char *command, int *status)
>  	if ((fd = fwts_pipe_open(command, &pid)) < 0)
>  		return FWTS_ERROR;
>  
> -	if (!(*status = fwts_pipe_close(fd, pid)))
> +	*status = fwts_pipe_close(fd, pid);
> +	if (*status)
>  		return FWTS_EXEC_ERROR;
>  	return FWTS_OK;
>  }
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu - Jan. 23, 2014, 5:28 a.m.
On 01/22/2014 11:54 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> fix inverted status check of exec calls. This is causing
> uefi tests to fail because of module load/unload is
> erroneously being reported to fail when it is in fact
> succeeding.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_pipeio.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
> index 1f21ed7..df07295 100644
> --- a/src/lib/src/fwts_pipeio.c
> +++ b/src/lib/src/fwts_pipeio.c
> @@ -179,7 +179,8 @@ int fwts_exec(const char *command, int *status)
>   	if ((fd = fwts_pipe_open(command, &pid)) < 0)
>   		return FWTS_ERROR;
>
> -	if (!(*status = fwts_pipe_close(fd, pid)))
> +	*status = fwts_pipe_close(fd, pid);
> +	if (*status)
>   		return FWTS_EXEC_ERROR;
>   	return FWTS_OK;
>   }
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
index 1f21ed7..df07295 100644
--- a/src/lib/src/fwts_pipeio.c
+++ b/src/lib/src/fwts_pipeio.c
@@ -179,7 +179,8 @@  int fwts_exec(const char *command, int *status)
 	if ((fd = fwts_pipe_open(command, &pid)) < 0)
 		return FWTS_ERROR;
 
-	if (!(*status = fwts_pipe_close(fd, pid)))
+	*status = fwts_pipe_close(fd, pid);
+	if (*status)
 		return FWTS_EXEC_ERROR;
 	return FWTS_OK;
 }