Re: closing file in adjust_data_dir

Поиск
Список
Период
Сортировка
От Japin Li
Тема Re: closing file in adjust_data_dir
Дата
Msg-id MEYP282MB1669F5DF52FBEEDCFD7F7F27B6079@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответ на Re: closing file in adjust_data_dir  (Ted Yu <yuzhihong@gmail.com>)
Ответы Re: closing file in adjust_data_dir  (Ted Yu <yuzhihong@gmail.com>)
Список pgsql-hackers
On Wed, 16 Nov 2022 at 11:15, Ted Yu <yuzhihong@gmail.com> wrote:
> On Tue, Nov 15, 2022 at 7:12 PM Japin Li <japinli@hotmail.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.



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

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: Re: libpq compression (part 2)
Следующее
От: Ted Yu
Дата:
Сообщение: Re: closing file in adjust_data_dir