diff mbox series

Same version must bve discarded by no-downgrading

Message ID 20190206163254.27255-1-sbabic@denx.de
State Changes Requested
Headers show
Series Same version must bve discarded by no-downgrading | expand

Commit Message

Stefano Babic Feb. 6, 2019, 4:32 p.m. UTC
no-downgrading means that only a newer version can be installed. If a
SWU contains the same version of what is already running, it must be
rejected.

Signed-off-by: Stefano Babic <sbabic@denx.de>
Reported-by: Matthias Schöpfer <matthias.schoepfer@googlemail.com>
---
 core/parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

'Darko Komljenovic' via swupdate Feb. 6, 2019, 4:45 p.m. UTC | #1
Hi Stefano!

Thanks for fixing this (and considering it a bug in the first place). 
You will have to adjust the error message from < to < = as well. 
Otherwise, it might confuse people...

Regards,

Matthias

On 2/6/19 5:32 PM, Stefano Babic wrote:
> no-downgrading means that only a newer version can be installed. If a
> SWU contains the same version of what is already running, it must be
> rejected.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> Reported-by: Matthias Schöpfer <matthias.schoepfer@googlemail.com>
> ---
>   core/parser.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/core/parser.c b/core/parser.c
> index 74375fd..6cf4e4b 100644
> --- a/core/parser.c
> +++ b/core/parser.c
> @@ -260,7 +260,7 @@ int parse(struct swupdate_cfg *sw, const char *descfile)
>   		__u64 currentversion = version_to_number(sw->globals.current_version);
>   		__u64 newversion = version_to_number(sw->version);
>   
> -		if (newversion < currentversion) {
> +		if (newversion <= currentversion) {
>   			ERROR("No downgrading allowed: new version %s < installed %s",
>   				sw->version, sw->globals.current_version);
>   			return -EPERM;
diff mbox series

Patch

diff --git a/core/parser.c b/core/parser.c
index 74375fd..6cf4e4b 100644
--- a/core/parser.c
+++ b/core/parser.c
@@ -260,7 +260,7 @@  int parse(struct swupdate_cfg *sw, const char *descfile)
 		__u64 currentversion = version_to_number(sw->globals.current_version);
 		__u64 newversion = version_to_number(sw->version);
 
-		if (newversion < currentversion) {
+		if (newversion <= currentversion) {
 			ERROR("No downgrading allowed: new version %s < installed %s",
 				sw->version, sw->globals.current_version);
 			return -EPERM;