commit 04b841e4697edff06c9f91aacea329b970b76f59 from: Stefan Sperling via: Thomas Adam date: Tue Jul 22 08:17:38 2025 UTC fix lseek(2) calls which had "offset" and "whence" arguments swapped commit - 46ed2a07cb70f0048a077607cbd491a4ab038cfb commit + 04b841e4697edff06c9f91aacea329b970b76f59 blob - 98bcc564cfc958b30147df6f23636bb01f6dc6dd blob + 6757ec025f7d70d415f9aaa6a5558b8d92a5f7fd --- lib/inflate.c +++ lib/inflate.c @@ -518,7 +518,7 @@ got_inflate_to_fd(size_t *outlen, FILE *infile, done: if (err == NULL) { - if (lseek(outfd, SEEK_SET, 0) == -1) + if (lseek(outfd, 0L, SEEK_SET) == -1) err = got_error_from_errno("lseek"); } got_inflate_end(&zb); blob - 7842b10124af03954b75dd4705583bd9b5e1942a blob + c443107e5db49c2345a36a6bc569434aa7c0fb83 --- lib/object_open_io.c +++ lib/object_open_io.c @@ -692,7 +692,7 @@ read_blob(uint8_t **outbuf, size_t *size, size_t *hdrl if (err) goto done; - if (lseek(infd, SEEK_SET, 0) == -1) { + if (lseek(infd, 0L, SEEK_SET) == -1) { err = got_error_from_errno("lseek"); goto done; } @@ -761,7 +761,7 @@ open_blob(struct got_blob_object **blob, struct got_re err = got_error_from_errno("ftruncate"); goto done; } - if (lseek(outfd, SEEK_SET, 0) == -1) { + if (lseek(outfd, 0L, SEEK_SET) == -1) { err = got_error_from_errno("lseek"); goto done; } blob - dddc70cab8165a46fcce4dce490b6024a04e44f0 blob + 353d91c5566e2cf939a1d1b2aea2461aec1de39c --- lib/object_open_privsep.c +++ lib/object_open_privsep.c @@ -847,7 +847,7 @@ request_packed_blob(uint8_t **outbuf, size_t *size, si if (err) return err; - if (lseek(outfd, SEEK_SET, 0) == -1) + if (lseek(outfd, 0L, SEEK_SET) == -1) err = got_error_from_errno("lseek"); return err; @@ -893,7 +893,7 @@ request_blob(uint8_t **outbuf, size_t *size, size_t *h if (err) return err; - if (lseek(outfd, SEEK_SET, 0) == -1) + if (lseek(outfd, 0L, SEEK_SET) == -1) return got_error_from_errno("lseek"); return err; @@ -946,7 +946,7 @@ open_blob(struct got_blob_object **blob, struct got_re err = got_error_from_errno("ftruncate"); goto done; } - if (lseek(outfd, SEEK_SET, 0) == -1) { + if (lseek(outfd, 0L, SEEK_SET) == -1) { err = got_error_from_errno("lseek"); goto done; } blob - 00ef12292ee99c13b11a184350a24f3e4abf2fdf blob + f7999b20113c136214ebfa35839d0a3ccca52260 --- lib/object_parse.c +++ lib/object_parse.c @@ -257,14 +257,14 @@ got_object_read_raw(uint8_t **outbuf, off_t *size, siz memset(&csum, 0, sizeof(csum)); csum.output_ctx = &ctx; - if (lseek(infd, SEEK_SET, 0) == -1) + if (lseek(infd, 0L, SEEK_SET) == -1) return got_error_from_errno("lseek"); err = got_object_read_header(&obj, infd); if (err) return err; - if (lseek(infd, SEEK_SET, 0) == -1) + if (lseek(infd, 0L, SEEK_SET) == -1) return got_error_from_errno("lseek"); if (obj->size + obj->hdrlen <= max_in_mem_size) { blob - ed4a42c8e7fbdbf1ea8ba1623c3b4086ea2975b4 blob + 0e2d5fd38c54fc7e8668b6abd11698445ef31e0a --- libexec/got-read-blob/got-read-blob.c +++ libexec/got-read-blob/got-read-blob.c @@ -167,7 +167,7 @@ main(int argc, char *argv[]) if (err) goto done; - if (lseek(fd, SEEK_SET, 0) == -1) { + if (lseek(fd, 0L, SEEK_SET) == -1) { err = got_error_from_errno("lseek"); goto done; } blob - 9bd7dc6de046f0f489c6c1a59c01fa89884c6a28 blob + 343a64acabc4ff2d0f9f92fe0cab59bada327a46 --- libexec/got-read-object/got-read-object.c +++ libexec/got-read-object/got-read-object.c @@ -68,7 +68,7 @@ send_raw_obj(struct imsgbuf *ibuf, struct got_object * off_t size; size_t hdrlen; - if (lseek(fd, SEEK_SET, 0) == -1) { + if (lseek(fd, 0L, SEEK_SET) == -1) { err = got_error_from_errno("lseek"); goto done; }