Re: closing file in adjust_data_dir - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: closing file in adjust_data_dir
Date
Msg-id 8f651e9b-ed48-f4e9-4b07-57f5f9c37c7e@enterprisedb.com
Whole thread Raw
In response to Re: closing file in adjust_data_dir  (Ted Yu <yuzhihong@gmail.com>)
Responses Re: closing file in adjust_data_dir
List pgsql-hackers
On 16.11.22 04:31, Ted Yu wrote:
>     On Wed, 16 Nov 2022 at 11:15, Ted Yu <yuzhihong@gmail.com
>     <mailto:yuzhihong@gmail.com>> wrote:
>      > On Tue, Nov 15, 2022 at 7:12 PM Japin Li <japinli@hotmail.com
>     <mailto: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.
> 
> Hi,
> Please take a look at the following:
> 
> https://en.cppreference.com/w/c/io/fgets 
> <https://en.cppreference.com/w/c/io/fgets>
> Quote: If the failure has been caused by some other error, sets the 
> /error/ indicator (see ferror() 
> <https://en.cppreference.com/w/c/io/ferror>) on |stream|. The contents 
> of the array pointed to by |str| are indeterminate (it may not even be 
> null-terminated).

That has nothing to do with the return value of fgets().




pgsql-hackers by date:

Previous
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: Perform streaming logical transactions by background workers and parallel apply
Next
From: "shiy.fnst@fujitsu.com"
Date:
Subject: RE: Fix some newly modified tab-complete changes