Re: [HACKERS][PATCH] adding simple sock check for windows - Mailing list pgsql-hackers

From CharSyam
Subject Re: [HACKERS][PATCH] adding simple sock check for windows
Date
Msg-id CAMrLSE7CC1=LHH5r+mHooS44ny=B69=qKMEVONVJt7NM41CzDg@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS][PATCH] adding simple sock check for windows  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: [HACKERS][PATCH] adding simple sock check for windows  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
Hi, Amit, It's good question. I also thought about it.

But, I want to leave original code intention.

Actually I think there is no case ( slot->sock is not PGINVALID_SOCKET
and slot->sock < 0)

but if original code want to check (sock < -1)

I think it is better to leave that condition.

but I think slot->sock == PGINVALID_SOCKET is enough

2018-03-31 14:38 GMT+09:00 Amit Kapila <amit.kapila16@gmail.com>:
> On Fri, Mar 30, 2018 at 8:10 PM, CharSyam <charsyam@gmail.com> wrote:
>> Hi, I found some missing check for windows int init_slot function in vacuumdb.c
>>
>> in windows
>> SOCKET is unsigned type. so
>>
>> slot->sock < 0 never can be under 0.
>>
>> so this patch just check using slot->sock == PGINVALID_SOCKET
>>
>
> - if (slot->sock < 0)
> + if (slot->sock == PGINVALID_SOCKET || slot->sock < 0)
>
> If you are checking for PGINVALID_SOCKET, why do you need the second
> part of check (slot->sock < 0)?
>
> --
> With Regards,
> Amit Kapila.
> EnterpriseDB: http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: WIP: Covering + unique indexes.
Next
From: Amit Kapila
Date:
Subject: Re: [HACKERS][PATCH] adding simple sock check for windows