| ... | @@ -3714,11 +3714,12 @@ pub fn sendfile( | ... | @@ -3714,11 +3714,12 @@ pub fn sendfile( |
| 3714 | hdtr = &hdtr_data; | 3714 | hdtr = &hdtr_data; |
| 3715 | } | 3715 | } |
| 3716 | | 3716 | |
| 3717 | const adjusted_count = math.min(count, max_count); | 3717 | const adjusted_count = math.min(count, @as(u63, max_count)); |
| 3718 | | 3718 | |
| 3719 | while (true) { | 3719 | while (true) { |
| 3720 | var sbytes: off_t = adjusted_count; | 3720 | var sbytes: off_t = adjusted_count; |
| 3721 | const err = errno(system.sendfile(out_fd, in_fd, in_offset, &sbytes, hdtr, flags)); | 3721 | const signed_offset = @bitCast(i64, in_offset); |
| | 3722 | const err = errno(system.sendfile(out_fd, in_fd, signed_offset, &sbytes, hdtr, flags)); |
| 3722 | const amt = @bitCast(usize, sbytes); | 3723 | const amt = @bitCast(usize, sbytes); |
| 3723 | switch (err) { | 3724 | switch (err) { |
| 3724 | 0 => return amt, | 3725 | 0 => return amt, |
| ... | @@ -3745,7 +3746,7 @@ pub fn sendfile( | ... | @@ -3745,7 +3746,7 @@ pub fn sendfile( |
| 3745 | EPIPE => return error.BrokenPipe, | 3746 | EPIPE => return error.BrokenPipe, |
| 3746 | | 3747 | |
| 3747 | else => { | 3748 | else => { |
| 3748 | _ = unexpectedErrno(err); | 3749 | const discard = unexpectedErrno(err); |
| 3749 | if (amt != 0) { | 3750 | if (amt != 0) { |
| 3750 | return amt; | 3751 | return amt; |
| 3751 | } else { | 3752 | } else { |