diff mbox series

installer: skip pointer test on postupdatecmd in postupdate()

Message ID 20181214144320.19704-1-christian.storm@siemens.com
State Accepted
Headers show
Series installer: skip pointer test on postupdatecmd in postupdate() | expand

Commit Message

Storm, Christian Dec. 14, 2018, 2:43 p.m. UTC
Since swcfg->globals.postupdatecmd is statically allocated,
the test always evaluates to true, hence remove it.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 corelib/installer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Stefano Babic Dec. 17, 2018, 9:20 a.m. UTC | #1
On 14/12/18 15:43, Christian Storm wrote:
> Since swcfg->globals.postupdatecmd is statically allocated,
> the test always evaluates to true, hence remove it.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  corelib/installer.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/corelib/installer.c b/corelib/installer.c
> index 3918d43..f7809d4 100644
> --- a/corelib/installer.c
> +++ b/corelib/installer.c
> @@ -457,8 +457,7 @@ int postupdate(struct swupdate_cfg *swcfg, const char *info)
>  {
>  	swupdate_progress_done(info);
>  
> -	if ((swcfg) && (swcfg->globals.postupdatecmd) &&
> -	    (strnlen(swcfg->globals.postupdatecmd,
> +	if ((swcfg) && (strnlen(swcfg->globals.postupdatecmd,
>  		     SWUPDATE_GENERAL_STRING_SIZE) > 0)) {
>  		DEBUG("Executing post-update command '%s'",
>  		      swcfg->globals.postupdatecmd);
> 
Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/corelib/installer.c b/corelib/installer.c
index 3918d43..f7809d4 100644
--- a/corelib/installer.c
+++ b/corelib/installer.c
@@ -457,8 +457,7 @@  int postupdate(struct swupdate_cfg *swcfg, const char *info)
 {
 	swupdate_progress_done(info);
 
-	if ((swcfg) && (swcfg->globals.postupdatecmd) &&
-	    (strnlen(swcfg->globals.postupdatecmd,
+	if ((swcfg) && (strnlen(swcfg->globals.postupdatecmd,
 		     SWUPDATE_GENERAL_STRING_SIZE) > 0)) {
 		DEBUG("Executing post-update command '%s'",
 		      swcfg->globals.postupdatecmd);