diff mbox series

[2/2] delta_handler: check return value of zck_end_chunk

Message ID 20240425115148.67894-2-michael.adler@siemens.com
State Accepted
Headers show
Series [1/2] delta_handler: remove unused imports and braces | expand

Commit Message

Michael Adler April 25, 2024, 11:51 a.m. UTC
Signed-off-by: Michael Adler <michael.adler@siemens.com>
Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 handlers/delta_handler.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Stefano Babic April 25, 2024, 12:40 p.m. UTC | #1
Hi Michael,

On 25.04.24 13:51, 'Michael Adler' via swupdate wrote:
> Signed-off-by: Michael Adler <michael.adler@siemens.com>
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>   handlers/delta_handler.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/handlers/delta_handler.c b/handlers/delta_handler.c
> index 7819630c..89160036 100644
> --- a/handlers/delta_handler.c
> +++ b/handlers/delta_handler.c
> @@ -507,7 +507,10 @@ static bool create_zckindex(zckCtx *zck, int fd, size_t maxbytes)
>   	}
>
>   	free(buf);
> -	zck_end_chunk(zck);
> +	if (zck_end_chunk(zck) < 0) {
> +		ERROR("ZCK failed to create chunk boundary: %s", zck_get_error(zck));
> +		return false;
> +	}
>
>   	if(n < 0) {
>   		ERROR("Error occurred while reading data : %s", strerror(errno));

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

Thanks, I saw the warning and I promised myself to fix it, and then
quick forgotten.

I apply it soon.

Best regards,
Stefano
diff mbox series

Patch

diff --git a/handlers/delta_handler.c b/handlers/delta_handler.c
index 7819630c..89160036 100644
--- a/handlers/delta_handler.c
+++ b/handlers/delta_handler.c
@@ -507,7 +507,10 @@  static bool create_zckindex(zckCtx *zck, int fd, size_t maxbytes)
 	}
 
 	free(buf);
-	zck_end_chunk(zck);
+	if (zck_end_chunk(zck) < 0) {
+		ERROR("ZCK failed to create chunk boundary: %s", zck_get_error(zck));
+		return false;
+	}
 
 	if(n < 0) {
 		ERROR("Error occurred while reading data : %s", strerror(errno));