"GOT", but the "O" is a cute, smiling sun Index | Thread

From:
Omar Polo <op@omarpolo.com>
Subject:
gotd: fix off_t printing
To:
gameoftrees@openbsd.org
Date:
Tue, 25 Oct 2022 18:27:42 +0200

Download raw body.

spotted while building on linux

diff /home/op/w/gotd
commit - 1c28a36116110db5de40e6edf09887651f3ca37b
path + /home/op/w/gotd
blob - 51a31d0b8608b9351cb8b63bfa93e3d5ab4f87f8
file + gotd/repo_write.c
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -524,7 +524,7 @@ copy_object_type_and_size(uint8_t *type, uint64_t *siz
 		/* We do not support size values which don't fit in 64 bit. */
 		if (i > 9)
 			return got_error_fmt(GOT_ERR_OBJ_TOO_LARGE,
-			    "packfile offset %llu", obj_offset);
+			    "packfile offset %lld", (long long)obj_offset);
 
 		if (buf_len(buf) - *buf_pos < sizeof(sizebuf[0])) {
 			err = read_more_pack_stream(infd, buf,
@@ -595,7 +595,7 @@ copy_offset_delta(int infd, int outfd, off_t *outsize,
 		/* We do not support offset values which don't fit in 64 bit. */
 		if (i > 8)
 			return got_error_fmt(GOT_ERR_OBJ_TOO_LARGE,
-			    "packfile offset %llu", obj_offset);
+			    "packfile offset %lld", (long long)obj_offset);
 
 		if (buf_len(buf) - *buf_pos < sizeof(offbuf[0])) {
 			err = read_more_pack_stream(infd, buf,
@@ -674,7 +674,8 @@ copy_zstream(int infd, int outfd, off_t *outsize, BUF 
 			if (zret != Z_OK && zret != Z_BUF_ERROR &&
 			    zret != Z_STREAM_END) {
 				err = got_error_fmt(GOT_ERR_DECOMPRESSION,
-				    "packfile offset %llu", zstream_offset);
+				    "packfile offset %lld",
+				    (long long)zstream_offset);
 				goto done;
 			}
 			consumed = z.total_in - last_total_in;