Re: libpq support for NegotiateProtocolVersion
От | Heikki Linnakangas |
---|---|
Тема | Re: libpq support for NegotiateProtocolVersion |
Дата | |
Msg-id | c8860dd3-bd1c-44eb-89c3-28a6e850be1e@iki.fi обсуждение исходный текст |
Ответ на | Re: libpq support for NegotiateProtocolVersion (Ranier Vilela <ranier.vf@gmail.com>) |
Список | pgsql-hackers |
On 03/04/2025 14:55, Ranier Vilela wrote: > Hi. > > Per Coverity. > > CID 1596094: (#1 of 1): Structurally dead code (UNREACHABLE) > unreachable: Since the loop increment i++; is unreachable, the loop body > will never execute more than once. That is true, and I think we should just silence it. The loop is is written that way in anticipation of future changes where libpq would actually request some protocol extensions, but would be happy to continue without server supporting them. But since we don't have any yet, it's always an error if the server responded with any unsupported protocol extensions. > The code of the function *pqGetNegotiateProtocolVersion3* is a little > confusing. > > I believe that the Coverity alert is valid. > The function never returns 0. It certainly does. It returns 0 when connecting to a pre-v18 server, with the "max_protocol_version=3.2" option. In that case, the local variable "num" is 0, the loop never executes, and the function returns 0. -- Heikki Linnakangas Neon (https://neon.tech)
В списке pgsql-hackers по дате отправления: