[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] tar,smemcap: silence compiler warning
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2021-08-22 13:45:24
Message-ID: CAK1hOcN58xa3VSmjq3zEUXiRpcD0kCvtcPe_2Hdm+ZyBb4kgTA () mail ! gmail ! com
[Download RAW message or body]

Applied, thank you

On Sun, Aug 22, 2021 at 12:25 PM Ron Yorston <rmy@pobox.com> wrote:
>
> gcc 11.2.1 complains that the tar header checksum might overflow
> the checksum field.  It won't and using an unsigned int for the
> calculation seems to convince the compiler too.
>
> Signed-off-by: Ron Yorston <rmy@pobox.com>
> ---
>  archival/chksum_and_xwrite_tar_header.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/archival/chksum_and_xwrite_tar_header.c b/archival/chksum_and_xwrite_tar_header.c
> index 25934f898..f2d46b9ef 100644
> --- a/archival/chksum_and_xwrite_tar_header.c
> +++ b/archival/chksum_and_xwrite_tar_header.c
> @@ -15,7 +15,7 @@ void FAST_FUNC chksum_and_xwrite_tar_header(int fd, struct tar_header_t *hp)
>          * (Sun and HP-UX gets it wrong... more details in
>          * GNU tar source) */
>         const unsigned char *cp;
> -       int chksum, size;
> +       unsigned int chksum, size;
>
>         strcpy(hp->magic, "ustar  ");
>
> --
> 2.31.1
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic