Hi,
I find that most of the code does not check the return value of close(), When open a file for reading(O_RDONLY).
But I find that it checks the return value of close() in code "src/bin/pg_rewind/copy_fetch.c" When open a file for
reading(O_RDONLY).
And it will call pg_fatal to cause premature exit.
I think that when closing a read-only file fails, it shouid not exit the program early.It should ensure that the
programexecution is completed.
Like below:
・src/bin/pg_rewind/copy_fetch.c
before
--------------------------
rewind_copy_file_range
{
...
if (close(srcfd) != 0)
pg_fatal("could not close file \"%s\": %m", srcpath); }
--------------------------
after
--------------------------
rewind_copy_file_range
{
...
close(srcfd);
}
--------------------------
Regards,
--
Lin