Should program exit, When close() failed for O_RDONLY mode
| От | Lin, Cuiping |
|---|---|
| Тема | Should program exit, When close() failed for O_RDONLY mode |
| Дата | |
| Msg-id | 3134406ac1a94ed590347d341ce89e65@G08CNEXMBPEKD05.g08.fujitsu.local обсуждение исходный текст |
| Ответы |
Re: Should program exit, When close() failed for O_RDONLY mode
|
| Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления: