diff mbox

fwts_exec: fix status check (LP: #1271607)

Message ID 1390406089-14016-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Jan. 22, 2014, 3:54 p.m. UTC
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(-)

Comments

Alex Hung Jan. 23, 2014, 2:02 a.m. UTC | #1
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. UTC | #2
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>
diff mbox

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;
 }