diff mbox series

[3/5] hawkbit: do not reset action_id when getting from env

Message ID 20240705065434.3608030-4-dominique.martinet@atmark-techno.com
State Accepted
Headers show
Series misc fixes | expand

Commit Message

Dominique Martinet July 5, 2024, 6:54 a.m. UTC
server_handle_initial_state() firsts get an action id from the server
and then overrides it with the env value, but there is no check if there
had been no env value, sending a request to id -1 to server.

The commit that added this reset also added code to only call
get_action_id_from_env() if action_id <= 0, so it did not need to reset
it: just leave the status quo of using the last value if it wasn't set.

Fixes: f3b1e1e26dfb ("hawkbit: check for validity of action_id")
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
 suricatta/server_hawkbit.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Stefano Babic July 5, 2024, 12:12 p.m. UTC | #1
On 05.07.24 08:54, Dominique Martinet wrote:
> server_handle_initial_state() firsts get an action id from the server
> and then overrides it with the env value, but there is no check if there
> had been no env value, sending a request to id -1 to server.
>
> The commit that added this reset also added code to only call
> get_action_id_from_env() if action_id <= 0, so it did not need to reset
> it: just leave the status quo of using the last value if it wasn't set.
>
> Fixes: f3b1e1e26dfb ("hawkbit: check for validity of action_id")
> Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
> ---
>   suricatta/server_hawkbit.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c
> index 26260b6bd5e0..2f7562c543db 100644
> --- a/suricatta/server_hawkbit.c
> +++ b/suricatta/server_hawkbit.c
> @@ -867,7 +867,6 @@ static void get_action_id_from_env(int *action_id)
>   	 * Get the acction_id that corresponds to the done update if it was
>   	 * stored.
>   	 */
> -	*action_id = -1;
>   	char *action_str = swupdate_vars_get("action_id", NULL);
>   	if (action_str) {
>   		int tmp = ustrtoull(action_str, NULL, 10);

Acked-by: Stefano Babic <stefano.babic@swupdate.org>

Best regards,
Stefano
diff mbox series

Patch

diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c
index 26260b6bd5e0..2f7562c543db 100644
--- a/suricatta/server_hawkbit.c
+++ b/suricatta/server_hawkbit.c
@@ -867,7 +867,6 @@  static void get_action_id_from_env(int *action_id)
 	 * Get the acction_id that corresponds to the done update if it was
 	 * stored.
 	 */
-	*action_id = -1;
 	char *action_str = swupdate_vars_get("action_id", NULL);
 	if (action_str) {
 		int tmp = ustrtoull(action_str, NULL, 10);