Re: innocuous: pgbench does FD_ISSET on invalid socket

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: innocuous: pgbench does FD_ISSET on invalid socket
Дата
Msg-id CAB7nPqTTZoiuVYGNonLVnZysStUSOfhKeO9FTrQbKWJ36UCdOA@mail.gmail.com
обсуждение исходный текст
Ответ на innocuous: pgbench does FD_ISSET on invalid socket  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: innocuous: pgbench does FD_ISSET on invalid socket  (Michael Paquier <michael.paquier@gmail.com>)
Re: innocuous: pgbench does FD_ISSET on invalid socket  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
On Sat, Feb 13, 2016 at 6:25 AM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> I noticed that pgbench calls FD_ISSET on a socket returned by
> PQsocket() without first checking that it's not invalid.  I don't think
> there's a real problem here because the socket was already checked a few
> lines above, but I think applying the same coding pattern to both places
> is cleaner.
>
> Any objections to changing it like this?  I'd probably backpatch to 9.5,
> but no further (even though this pattern actually appears all the way
> back.)

Not really, +1 for consistency here, and this makes the code clearer.

Different issues in the same area:
1) In vacuumdb.c, init_slot() does not check for the return value of PQsocket():
slot->sock = PQsocket(conn);
2) In isolationtester.c, try_complete_step() should do the same.
3) In pg_recvlogical.c for StreamLogicalLog() I am spotting the same problem.
I guess those ones should be fixed as well, no?
-- 
Michael



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Refectoring of receivelog.c
Следующее
От: Rushabh Lathia
Дата:
Сообщение: Re: Optimization for updating foreign tables in Postgres FDW