From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Ted Yu <yuzhihong(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: closing file in adjust_data_dir |
Date: | 2022-11-16 03:26:25 |
Message-ID: | MEYP282MB1669F5DF52FBEEDCFD7F7F27B6079@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, 16 Nov 2022 at 11:15, Ted Yu <yuzhihong(at)gmail(dot)com> wrote:
> On Tue, Nov 15, 2022 at 7:12 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
>> After some rethinking, I find the origin code do not have problems.
>>
>> If fd is NULL or fgets() returns NULL, the process exits. Otherwise, we
>> call
>> pclose() to close fd. The code isn't straightforward, however, it is
>> correct.
>>
>>
>>
>> Please read this sentence from my first post:
>
> If the fgets() call doesn't return NULL, the pclose() would be skipped.
fgets() returns non-NULL, it means the second condition is false, and
it will check the third condition, which calls pclose(), so it cannot
be skipped, right?
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From | Date | Subject | |
---|---|---|---|
Next Message | Ted Yu | 2022-11-16 03:31:55 | Re: closing file in adjust_data_dir |
Previous Message | Justin Pryzby | 2022-11-16 03:17:28 | Re: libpq compression (part 2) |