[PATCH] tar,smemcap: silence compiler warning

Ron Yorston rmy at pobox.com
Sun Aug 22 10:24:46 UTC 2021


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 at 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



More information about the busybox mailing list