Re: Fix port/pg_iovec.h building extensions on x86_64-darwin

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Wolfgang Walther <walther(at)technowledgy(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix port/pg_iovec.h building extensions on x86_64-darwin
Date: 2024-11-08 20:00:36
Message-ID: Zy5t5FAmNKsJGf44@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 08, 2024 at 08:08:06PM +0100, Wolfgang Walther wrote:
> @@ -68,7 +68,7 @@ pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
> }
> sum += part;
> offset += part;
> - if (part < iov[i].iov_len)
> + if ((size_t) part < iov[i].iov_len)
> return sum;
> }
> return sum;
> @@ -107,7 +107,7 @@ pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
> }
> sum += part;
> offset += part;
> - if (part < iov[i].iov_len)
> + if ((size_t) part < iov[i].iov_len)
> return sum;
> }
> return sum;

This looks correct to me. At this point in the code, we know that part >=
0, so casting it to an unsigned long ought to be okay.

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2024-11-08 21:19:19 Re: New "single" COPY format
Previous Message Daniel Verite 2024-11-08 19:44:30 Re: New "single" COPY format