more macos fixes

master
Andrew Kelley 2020-03-03 03:10:56 -05:00
parent 859fc856d3
commit a66c72749a
1 changed files with 4 additions and 3 deletions

View File

@ -3714,11 +3714,12 @@ pub fn sendfile(
hdtr = &hdtr_data;
}
const adjusted_count = math.min(count, max_count);
const adjusted_count = math.min(count, @as(u63, max_count));
while (true) {
var sbytes: off_t = adjusted_count;
const err = errno(system.sendfile(out_fd, in_fd, in_offset, &sbytes, hdtr, flags));
const signed_offset = @bitCast(i64, in_offset);
const err = errno(system.sendfile(out_fd, in_fd, signed_offset, &sbytes, hdtr, flags));
const amt = @bitCast(usize, sbytes);
switch (err) {
0 => return amt,
@ -3745,7 +3746,7 @@ pub fn sendfile(
EPIPE => return error.BrokenPipe,
else => {
_ = unexpectedErrno(err);
const discard = unexpectedErrno(err);
if (amt != 0) {
return amt;
} else {